Skip to content
This repository was archived by the owner on Jan 3, 2026. It is now read-only.

Commit 71fef7b

Browse files
Refactor/server env config (#9)
1 parent 90793a3 commit 71fef7b

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

server/src/index.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
import dotenv from 'dotenv';
2+
import path from 'path';
13
import express, { Request, Response } from 'express';
24
import cors from 'cors';
35
import mongoose from 'mongoose';
4-
import dotenv from 'dotenv';
56

6-
dotenv.config();
7+
dotenv.config({
8+
path: path.resolve(
9+
process.cwd(),
10+
process.env.NODE_ENV === 'production'
11+
? '.env.production'
12+
: '.env.development'
13+
),
14+
});
715

816
const app = express();
917
const PORT = process.env.PORT || 5000;

0 commit comments

Comments
 (0)