Skip to content

Commit f7bc4c2

Browse files
committed
env file in nodeJs
1 parent 64e6971 commit f7bc4c2

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

server/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/node_modules
1+
/node_modules
2+
.env

server/package-lock.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"license": "ISC",
1212
"dependencies": {
1313
"cors": "^2.8.5",
14+
"dotenv": "^16.3.1",
1415
"express": "^4.18.2",
1516
"http": "^0.0.1-security",
1617
"jsonwebtoken": "^9.0.2",

server/server.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ const cors = require('cors');
55
const docRouter = require('./routes/doc');
66
const http = require('http');
77
const Document = require("./models/doc_model");
8+
require('dotenv').config();
89

9-
const URL = "mongodb+srv://vaibhav:[email protected]/?retryWrites=true&w=majority";
10+
const URL = `${process.env.MONOGOOSE_CONNECTION_STRING}`;
1011
const app = express();
1112

1213
app.use(express.json());

0 commit comments

Comments
 (0)