Giter VIP home page Giter VIP logo

ngrok's Introduction

ngrok Build Status

alt ngrok.com

Ngrok exposes your localhost to the web. https://ngrok.com/

NPM

It will download the ngrok binary for your platform and put it into the bin folder.

Also you can install ngrok globally and use ngrok directly from bash

$ npm install ngrok -g
$ ngrok 8080

usage

Just require ngrok and call connect method with a port and callback function:

var ngrok = require('ngrok');

ngrok.connect(8080, function (err, url) {
	// https://757c1652.ngrok.com -> 127.0.0.1:8080 
});

Or you may want to use some of the advanced ngrok options like:

var ngrok = require('ngrok');

ngrok.connect({
	authtoken: 'your-token',
	subdomain: 'susanna',
	httpauth: 'user:pwd',
	port: 8080
}, function (err, url) {
	// https://susanna.ngrok.com -> 127.0.0.1:8080 with http auth required
});

Or even create a tunnel that works based on protocols other then http.

var ngrok = require('ngrok');

// create tunnel for your local amqp setup
ngrok.connect({
	// http is the default protocol (and you should use it for the https
	// support) but tcp will work for everything else.
	proto: 'tcp',
	authtoken: 'your-token',
	port: 5672
}, function (err, url) {
	// tcp://abcd.ngrok.com:60234 -> 127.0.0.1:5762
});

When tunnel is established you can use the ngrok interface http://127.0.0.1:4040 to inspect the webhooks done via ngrok.

The tunnel will be killed when node process is done. For manual shutdown use

ngrok.disconnect();

emitter

Also you can use ngrok as an event emitter, it fires "connect", "disconnect" and "error" events

ngrok.once('connect', function (url) {
	console.log('got a tunnel url', url);
});

ngrok.connect(port);

ngrok's People

Contributors

bubenshchykov avatar lightsofapollo avatar javagarcia avatar jcblw avatar jnovack avatar jessefulton avatar

Watchers

Cesar Andreu avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.