Skip to content

Commit

Permalink
fix: init server
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftpsh committed Mar 17, 2024
1 parent ddf3ee0 commit bd7552b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ app.use(helmet());
app.use(
cors({
credentials: true,
origin: process.env.NODE_ENV !== "production" ? true : /solved\.ac$/,
origin: true,
// process.env.NODE_ENV !== "production" ? true : /colonizer\.training$/,
optionsSuccessStatus: 200,
})
);
Expand Down Expand Up @@ -72,7 +73,7 @@ app.use(
})
);

app.use("/api/v3", api);
app.use("/api", api);

if (process.env.NODE_ENV !== "production") {
app.use("/api-docs", swaggerUI.serve, swaggerUI.setup(swagger));
Expand All @@ -84,6 +85,15 @@ process.on("unhandledRejection", () => {

app.use(runtypeErrorHandler);

server.listen(app.get("port"), () => {
if (process.send !== undefined) {
process.send("ready");
}

// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
console.log(`Server listening on port ${app.get("port")}...`);
});

process.on("SIGINT", () => {
app.use((req, res, next) => {
res.set("Connection", "close");
Expand Down

0 comments on commit bd7552b

Please sign in to comment.