diff --git a/src/index.ts b/src/index.ts index 3a05cdfa..6a0fabc4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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); diff --git a/src/middlewares/CORS.ts b/src/middlewares/CORS.ts new file mode 100644 index 00000000..336051bd --- /dev/null +++ b/src/middlewares/CORS.ts @@ -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", "*"); +} diff --git a/src/routes/gateway.ts b/src/routes/gateway.ts index 53302f12..edbb8890 100644 --- a/src/routes/gateway.ts +++ b/src/routes/gateway.ts @@ -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;