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:
parent
763afac56e
commit
e971ba1b62
@ -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
7
src/middlewares/CORS.ts
Normal 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", "*");
|
||||
}
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user