bridgecord/index.js
2022-02-15 14:24:46 +02:00

28 lines
No EOL
760 B
JavaScript

import http from "node:http";
import express from "express";
import apiRoute from "./routes/api.js";
import { mainHttpListenPort } from "./config.js";
import { bot, logger } from "./common.js";
import GatewayServer from "./GatewayServer.js";
const log = logger("log", "ServerMain");
// might introduce bugs and probably a bad idea
Object.freeze(Object.prototype);
Object.freeze(Object);
const app = express();
const httpServer = http.createServer(app);
const gatewayServer = new GatewayServer(httpServer, {
path: "/gateway"
});
app.use(express.json());
app.use("/", express.static("frontend/public/"));
app.use("/api/v1", apiRoute);
httpServer.listen(mainHttpListenPort, () => {
log(`http listen on ${mainHttpListenPort}`);
bot.connect();
});