forked from robbie-cahill/tunnelmole-service
-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.ts
29 lines (23 loc) · 750 Bytes
/
app.ts
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
//@ts-ignore
import tunnelmoleConnections from "./src/handlers/tunnelmole-connections";
import handleRequest from "./src/handlers/handle-request";
import logTelemetry from "./src/handlers/log-telemetry";
import express from "express";
import bodyParser from "body-parser";
const app = express();
// Body will be a Buffer, easy to transfer to the client untouched
const options = {
inflate: false,
type: "*/*",
};
app.use(bodyParser.raw(options));
app.get("/tunnelmole-connections", tunnelmoleConnections);
app.post("/tunnelmole-log-telemetry", logTelemetry);
/**
* Handle incoming HTTP(s) requests for existing connections
*/
app.all("*", handleRequest);
/**
* Initialize a new WebSocket connection with a Client
*/
export default app;