remove legacy handler and clean up index.js

This commit is contained in:
hippoz 2021-08-22 00:41:51 +03:00
parent 7dda7fbcb2
commit a429348c7d
Signed by: hippoz
GPG key ID: 7C52899193467641

View file

@ -1,18 +1,16 @@
const config = require("./config");
const apiRoute = require("./api/v1");
const GatewayServerV2 = require("./api/v2/gateway/index");
const express = require("express");
const cookieParser = require("cookie-parser");
const cors = require("cors");
const http = require("http");
const { authenticateEndpoint } = require("./common/auth/authfunctions");
const GatewayServerV2 = require("./api/v2/gateway/index");
const app = express();
const httpServer = http.createServer(app);
const gatewayv2 = new GatewayServerV2({ server: httpServer });
new GatewayServerV2({ server: httpServer });
app.use(express.urlencoded({ extended: false }));
app.use(express.json());
@ -31,10 +29,6 @@ app.use(cors({
app.use("/api/v1", apiRoute);
app.use(express.static("app"));
app.get("/", authenticateEndpoint((req, res) => {
res.redirect("/app.html");
}, "/auth.html"));
app.use((err, req, res, next) => {
console.error("[E] Internal server error", err);
res.status(500).json({ error: true, status: 500, message: "ERR_INTERNAL_SERVER_ERROR" });