Created
March 23, 2020 20:56
-
-
Save abdihaikal/e71a982704e1d8f2afc92d348dd6c2bc to your computer and use it in GitHub Desktop.
How to implementing ngrok with browser-sync
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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