-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (27 loc) · 825 Bytes
/
index.js
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
// initlizing express and app
const express = require('express');
const app = express();
//importing .env, db and passport config
require('dotenv').config();
const db = require('./config/mongoose');
const passport = require('passport');
const passportjwt = require('./config/passport-jwt');
//using json and urlencoded middlware to parse the json and submitted form
app.use(express.json());
app.use(
express.urlencoded({
extended: true,
})
);
//initilizing passport
app.use(passport.initialize());
// using the routes to user Route module for routing
app.use('/', require('./routes'));
//listing to request
app.listen(process.env.PORT, (err) => {
if (err) {
console.log(err, 'Error while running server !');
}
console.log('Server running on port ', process.env.PORT);
return;
});