-
Notifications
You must be signed in to change notification settings - Fork 1
/
test-local-tunnel.js
51 lines (39 loc) · 1.2 KB
/
test-local-tunnel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// const http = require('http');
// const localtunnel = require('localtunnel');
// const createTunnel = () =>
// new Promise(resolve => {
// localtunnel(8090, function(err, tunnel) {
// resolve(tunnel);
// });
// });
// (async () => {
// var tunnel = await createTunnel();
// tunnel.on('close', () => {
// console.log('close');
// });
// tunnel.on('request', (a, b, c) => {
// console.log('request');
// console.log(a, b, c);
// });
// tunnel.on('error', () => {
// console.log('error');
// });
// console.log(tunnel.url);
// const server = http
// .createServer((req, res) => {
// console.log(req);
// res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
// res.write('hello');
// res.end();
// })
// .listen(8090);
// })();
const shelljs = require('shelljs');
const version = shelljs.exec('node --version', { silent: true }).stdout;
console.log('version : ', version);
// const tunnel = shelljs.exec('npx lt --port 7575', { silent: true }).stdout;
// console.log('tunnel : ', tunnel);
const localtunnel = require('localtunnel');
localtunnel(7575, (err, tunnel) => {
console.log('tunnel : ', tunnel);
});