Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const localtunnel = require('localtunnel')
- const tunels = [{
- subdomain: 'youDomain',
- local_host: 'localhost',
- port: 4000,
- }, {
- subdomain: 'youDomain',
- local_host: 'localhost',
- port: 3000,
- }]
- const tlTunels = {}
- const run = async (options, key) => {
- tlTunels[key] = localtunnel(options.port, options, (err, tl) => {
- if (err) {
- run(options, key)
- } else {
- console.log('Running', tl.url)
- }
- })
- tlTunels[key].on('error', (e) => {
- console.log(e)
- run(options, key)
- })
- tlTunels[key].on('close', (e) => {
- console.log(e)
- run(options, key)
- })
- }
- tunels.forEach((options, key) => {
- run(options, key)
- })
Add Comment
Please, Sign In to add comment