
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
@achingbrain/ngrok
Advanced tools


Ngrok exposes your localhost to the web. https://ngrok.com/
It will download the ngrok 2.0 binary for your platform and put it into the bin folder. You can also install ngrok globally and use it directly from bash
$ npm install ngrok -g
$ ngrok http 8080
var ngrok = require('ngrok');
ngrok.connect(function (err, url) {}); // https://757c1652.ngrok.io -> http://localhost:80
ngrok.connect(9090, function (err, url) {}); // https://757c1652.ngrok.io -> http://localhost:9090
ngrok.connect({proto: 'tcp', addr: 22}, function (err, url) {}); // tcp://0.tcp.ngrok.io:48590
ngrok.connect(opts, function(err, url) {});
First connect spawns the ngrok process so each next tunnel is created much faster.
ngrok.connect({
proto: 'http', // http|tcp|tls
addr: 8080, // port or network address
auth: 'user:pwd', // http basic authentication for tunnel
subdomain: 'alex', // reserved tunnel name https://alex.ngrok.io,
authtoken: '12345' // your authtoken from ngrok.com
}, function (err, url) {});
Other options: name, inspect, host_header, bind_tls, hostname, crt, key, client_cas, remote_addr - read here
The ngrok and all tunnels will be killed when node process is done. To stop the tunnels use
ngrok.disconnect(url); // stops one
ngrok.disconnect(); // stops all
ngrok.kill(); // kills ngrok process
Many advanced features of the ngrok.com service require that you sign up for an account and use authtoken. The authtoken you specify is not the same as the one you used for ngrok 1.0 - module versions prior to 0.2. Your 2.0 ngrok authtoken is available on your ngrok 2.0 dashboard.
You can pass it as option with each connect or set it once for further tunnels
javascript
ngrok.authtoken(token, function(err, token) {});
## emitter
Also you can use ngrok as an event emitter, it fires "connect", "disconnect" and "error" events
```javascript
ngrok.once('connect', function (url) {};
ngrok.connect(port);
You can use ngrok's configurations files, then just pass name option when making a tunnel
OS X /Users/example/.ngrok2/ngrok.yml
Linux /home/example/.ngrok2/ngrok.yml
Windows C:\Users\example\.ngrok2\ngrok.yml
When tunnel is established you can use the ngrok interface http://127.0.0.1:4040 to inspect the webhooks done via ngrok.
FAQs
node wrapper for ngrok
The npm package @achingbrain/ngrok receives a total of 1 weekly downloads. As such, @achingbrain/ngrok popularity was classified as not popular.
We found that @achingbrain/ngrok demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.