bridgecord/index.js

26 lines
726 B
JavaScript
Raw Normal View History

import http from "node:http";
import express from "express";
import apiRoute from "./routes/api.js";
import { mainHttpListenPort } from "./config.js";
import { bot } from "./common.js";
import GatewayServer from "./GatewayServer.js";
2022-02-02 20:24:14 +02:00
// 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());
2022-02-02 20:24:14 +02:00
app.use("/", express.static("frontend/public/"));
app.use("/api/v1", apiRoute);
httpServer.listen(mainHttpListenPort, () => {
console.log(`server main: listen on ${mainHttpListenPort}`);
bot.connect();
});