prefix middleware

main
km0 2 years ago
parent b201a61164
commit 86ee3fedd8

@ -5,16 +5,22 @@ dotenv.config();
const express = require("express");
const PORT = process.env.PORT || 3000;
const index = "index.html";
const PREFIX = process.env.PREFIX || "";
const server = express()
.use(express.static("public"))
.get("/", (req, res) => {
const router = express.Router();
const routes = (app) => {
app.get("/", (req, res) => {
res.sendFile("index.html", { root: __dirname });
})
.get("/destination", (req, res) => {
});
app.get("/destination", (req, res) => {
res.sendFile("destination.html", { root: __dirname });
})
});
return app;
};
const server = express()
.use(PREFIX, routes(router, {}))
.use(express.static("public"))
.listen(PORT, () => console.log(`Listening on ${PORT}`));
const wss = new WebSocketServer({ server, clientTracking: true });

Loading…
Cancel
Save