-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
39 lines (26 loc) · 879 Bytes
/
server.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
33
34
35
36
37
38
39
require('dotenv').config();
const express = require('express');
const mongoose = require('mongoose');
const cors = require('cors');
const jwt = require('jsonwebtoken');
const bcrypt = require('bcryptjs');
const SECRET = process.env.SECRET_KEY;
const app = express();
const PORT = process.env.PORT || 8080;
// Middleware
app.use(express.json());
app.use((req, res, next) => {
console.log(req.body)
next()
})
app.use(cors());
mongoose.connect(process.env.MONGO_URI, {
useUnifiedTopology: true,
useNewUrlParser: true,
useCreateIndex: true,
useFindAndModify: false
});
mongoose.connection.once('connected', () => console.log('Connected To Mongo'));
app.use('/account', require('./controllers/loginRegisterController'))
app.use('/Events', require('./controllers/eventController'))
app.listen(PORT, () => console.log(`Listening on port: ${PORT}`));