-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (30 loc) · 875 Bytes
/
index.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
const localtunnel = require('localtunnel');
const express = require('express');
const viber = require('./client/viber');
const telegram = require('./client/telegram');
const facebook = require('./client/facebook');
const PORT = process.env.HTTP_PORT || 0;
const HOST = process.env.HTTP_HOST || '0.0.0.0';
const app = express();
app.use(
express.json(),
express.urlencoded({ extended: true })
);
app.use(
facebook.route,
telegram.route,
viber.route
);
app.listen(PORT, HOST, async function () {
try {
const { port } = this.address();
const tunnel = await localtunnel({ port });
await facebook.hook(tunnel.url);
await viber.hook(tunnel.url);
await telegram.hook(tunnel.url);
console.log(`started ${tunnel.url}`);
} catch (err) {
console.error(err);
process.exit(1);
}
});