Exposes local port to the web.
This plugin requires Grunt ~0.4.0
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-ngrok --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-ngrok');
Run this task with the grunt ngrok
command.
See the ngrok website for details about what each key does (https://ngrok.com/docs)
authToken
compressConn
consolueUI
httpProxy
inspectDBSize
log
logFormat
logLevel
metadata
region
rootCAS
socks5Proxy
update
updateChannel
webAddr
addr
auth
bindTLS
crt
hostname
hostHeader
inspect
key
proto
remoteAddr
subdomain
example:
grunt.initConfig({
ngrok: {
options: {
authToken: '-your-auth-token',
onConnected: function(url) {
grunt.log.writeln('Local server exposed to %s!', url);
}
},
server: {
proto: 'tcp',
addr: 50010,
remoteAddr: 50010,
subdomain: 'mytestapp',
},
},
});
Notice global go inside the options object, while the new tunnels you want to open (i.e. server
)
have their own object, with tunnel specific options in it.
The ngrok plugin will emit a grunt event, ngrok.{taskName}.connected
, once connected.
You can listen for this event to run things against a keepalive server, for example:
grunt.registerTask('jasmine-server', 'start web server for jasmine tests in browser', function() {
grunt.task.run('jasmine:tests:build');
grunt.event.once('ngrok.tests.connected', function(url) {
var specRunnerUrl = url + '/_SpecRunner.html';
grunt.log.writeln('Jasmine specs available at: ' + specRunnerUrl);
require('open')(specRunnerUrl);
});
grunt.task.run('ngrok:tests');
});