forked from tanishq252/inter-buddy-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
39 lines (31 loc) · 1.13 KB
/
index.js
File metadata and controls
39 lines (31 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import express from 'express';
import cors from 'cors';
import bodyParser from 'body-parser';
import mongoose from 'mongoose';
// import dotenv from 'dotenv';
const PORT = 4000;
import companyRoutes from './routers/company.js';
import interviewexpRoutes from './routers/interview.js';
import userRoutes from './routers/user.js'
// initializing the app
const app = express();
// dotenv.config();
// cross origin resource sharing
app.use(cors());
// for images and posting data
app.use(bodyParser.json({limit: "30mb", extended: true}));
app.use(bodyParser.urlencoded({limit: "30mb", extended: true}));
app.use('/company', companyRoutes);
app.use('/interviews', interviewexpRoutes);
app.use('/user', userRoutes)
app.get('/', (req, res)=>{
res.send("Home Page");
})
mongoose.connect('mongodb+srv://tanishq777:tanishq777@cluster0.lzgyb.mongodb.net/WTCP?retryWrites=true&w=majority', { useNewUrlParser: true });
const connection = mongoose.connection;
connection.once('open', function() {
console.log("MongoDB database connection established successfully");
})
app.listen(PORT, function() {
console.log("Server is running on Port: " + PORT);
});