env variables for easier dev setup
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import "dotenv/config";
|
||||
import cors from "cors";
|
||||
const corsConfig = { origin: "https://ches.su", credentials: true };
|
||||
|
||||
import express, { Request, Response, NextFunction } from "express";
|
||||
import { createServer } from "http";
|
||||
@@ -11,6 +10,11 @@ import { db } from "./db";
|
||||
|
||||
import routes from "./routes";
|
||||
|
||||
const corsConfig = {
|
||||
origin: process.env.CORS_ORIGIN || "http://localhost:3000",
|
||||
credentials: true
|
||||
};
|
||||
|
||||
const app = express();
|
||||
const server = createServer(app);
|
||||
|
||||
@@ -40,7 +44,7 @@ io.use((socket, next) => {
|
||||
});
|
||||
initSocket();
|
||||
|
||||
const port = process.env.PORT || 3000;
|
||||
const port = process.env.PORT || 3001;
|
||||
server.listen(port, () => {
|
||||
console.log(`listening on :${port}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user