1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 05:02:37 +01:00

🎨 change default port to 1000 + CORS

This commit is contained in:
Flam3rboy 2021-04-19 22:00:48 +02:00
parent 763afac56e
commit e971ba1b62
3 changed files with 9 additions and 2 deletions

View File

@ -7,7 +7,7 @@ config();
import { DiscordServer } from "./Server";
var port = Number(process.env.PORT);
if (isNaN(port)) port = 3000;
if (isNaN(port)) port = 1000;
const server = new DiscordServer({ port });
server.start().catch(console.error);

7
src/middlewares/CORS.ts Normal file
View File

@ -0,0 +1,7 @@
import { NextFunction, Request, Response } from "express";
// TODO: config settings
export function CORS(req: Request, res: Response, next: NextFunction) {
res.set("Access-Control-Allow-Origin", "*");
}

View File

@ -3,7 +3,7 @@ import { Router } from "express";
const router = Router();
router.get("/", (req, res) => {
res.send({ url: "ws://localhost:8080" });
res.send({ url: "ws://localhost:2000" });
});
export default router;