forked from hippoz/brainlet
remove legacy handler and clean up index.js
This commit is contained in:
parent
7dda7fbcb2
commit
a429348c7d
1 changed files with 2 additions and 8 deletions
|
@ -1,18 +1,16 @@
|
||||||
const config = require("./config");
|
const config = require("./config");
|
||||||
const apiRoute = require("./api/v1");
|
const apiRoute = require("./api/v1");
|
||||||
|
const GatewayServerV2 = require("./api/v2/gateway/index");
|
||||||
|
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const cookieParser = require("cookie-parser");
|
const cookieParser = require("cookie-parser");
|
||||||
const cors = require("cors");
|
const cors = require("cors");
|
||||||
const http = require("http");
|
const http = require("http");
|
||||||
|
|
||||||
const { authenticateEndpoint } = require("./common/auth/authfunctions");
|
|
||||||
const GatewayServerV2 = require("./api/v2/gateway/index");
|
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const httpServer = http.createServer(app);
|
const httpServer = http.createServer(app);
|
||||||
|
|
||||||
const gatewayv2 = new GatewayServerV2({ server: httpServer });
|
new GatewayServerV2({ server: httpServer });
|
||||||
|
|
||||||
app.use(express.urlencoded({ extended: false }));
|
app.use(express.urlencoded({ extended: false }));
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
@ -31,10 +29,6 @@ app.use(cors({
|
||||||
app.use("/api/v1", apiRoute);
|
app.use("/api/v1", apiRoute);
|
||||||
app.use(express.static("app"));
|
app.use(express.static("app"));
|
||||||
|
|
||||||
app.get("/", authenticateEndpoint((req, res) => {
|
|
||||||
res.redirect("/app.html");
|
|
||||||
}, "/auth.html"));
|
|
||||||
|
|
||||||
app.use((err, req, res, next) => {
|
app.use((err, req, res, next) => {
|
||||||
console.error("[E] Internal server error", err);
|
console.error("[E] Internal server error", err);
|
||||||
res.status(500).json({ error: true, status: 500, message: "ERR_INTERNAL_SERVER_ERROR" });
|
res.status(500).json({ error: true, status: 500, message: "ERR_INTERNAL_SERVER_ERROR" });
|
||||||
|
|
Loading…
Reference in a new issue