Skip to content

Commit f4a558e

Browse files
authored
Merge pull request #4 from AdityaAparadh/main
Added MERN Stack (Finally)
2 parents 958ba9e + 8c9bf61 commit f4a558e

File tree

21 files changed

+6324
-0
lines changed

21 files changed

+6324
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM node:latest
2+
3+
WORKDIR /app
4+
5+
COPY . .
6+
7+
RUN npm i
8+
9+
RUN npm i -g nodemon
10+
11+
EXPOSE 3000
12+
13+
CMD ["npm","run","dev"]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const mongoose = require('mongoose')
2+
DB_URI = process.env.DB_URI || "mongodb://localhost:27017"
3+
4+
const db = ()=>{
5+
try{
6+
mongoose.connect(DB_URI)
7+
console.log(`Connected to MongoDB at : ${DB_URI}`)
8+
}catch( error ){
9+
console.error("AN ERROR OCCURED IN DATABASE CONNECTION")
10+
console.error(error)
11+
}
12+
}
13+
14+
module.exports = db

0 commit comments

Comments
 (0)