public virtual path prefix

main
km0 2 years ago
parent 86ee3fedd8
commit f818ecf3f7

@ -6,6 +6,7 @@ const express = require("express");
const PORT = process.env.PORT || 3000; const PORT = process.env.PORT || 3000;
const PREFIX = process.env.PREFIX || ""; const PREFIX = process.env.PREFIX || "";
const PUBLIC = process.env.PUBLIC || "";
const router = express.Router(); const router = express.Router();
const routes = (app) => { const routes = (app) => {
@ -20,7 +21,7 @@ const routes = (app) => {
const server = express() const server = express()
.use(PREFIX, routes(router, {})) .use(PREFIX, routes(router, {}))
.use(express.static("public")) .use(PUBLIC, 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 });

Loading…
Cancel
Save