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