-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (25 loc) · 979 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
const mongooseUri = "mongodb+srv://test:[email protected]/DailyGymChallenge?retryWrites=true&w=majority"
, port = 3001
;
const app = require('express')()
, http = require('http').Server(app).listen(port)
, bodyParser = require('body-parser')
, mongoose = require('mongoose')
;
const userController = require('./controllers/user_controller')
, challengeController = require('./controllers/challenge_controller')
;
const db = require('./mocks/createData');
mongoose.connect(mongooseUri, { useNewUrlParser: true })
.then(() => {
console.log('Connected...');
db.createUsers();
db.createChallenges();
})
.catch( error => {
console.log('Something went wrong...', error);
});
app.use(bodyParser.json({limit: '250mb', extended: true}));
app.use(bodyParser.urlencoded({limit: '250mb', extended: true}));
app.use('/user', userController);
app.use('/challenge', challengeController);