Skip to content

Instantly share code, notes, and snippets.

@abdihaikal
Created March 23, 2020 20:56
Show Gist options
  • Save abdihaikal/e71a982704e1d8f2afc92d348dd6c2bc to your computer and use it in GitHub Desktop.
Save abdihaikal/e71a982704e1d8f2afc92d348dd6c2bc to your computer and use it in GitHub Desktop.
How to implementing ngrok with browser-sync
const browserSync = require('browser-sync'); // @link https://www.npmjs.com/package/browser-sync
const ngrok = require('ngrok'); // @link https://www.npmjs.com/package/ngrok
// Create BrowserSync instance
const instance = browserSync.create("Whatever-Name-You-Want");
// BrowserSYnc Options
// @link https://browsersync.io/docs/options
const options = {...}
// Implementing ngrok
instance.init(options, (err, bs) => {
ngrok.connect(bs.options.get('port')).then(ngrokUrl => {
console.log("Ngrok URL", ":", ngrokUrl);
})
return true
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment