-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
52 lines (46 loc) · 1.71 KB
/
app.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
40
41
42
43
44
45
46
47
48
49
50
51
52
const app = require('express')()
const bodyParser = require('body-parser')
const logger = require('./controllers/logger.js')
require('./configs/mongobd/mongodb-config')
// importing global middleware
const GlobalUserIdentifier = require('./middleware/GlobalUserIdentifier.js')
// importing routes
const CreateRoute = require('./routes/user/CreateRoute.js')
const GetUser = require('./routes/user/GetUser.js')
const GetUserStories = require('./routes/user/GetUserStories.js')
const CreateStory = require('./routes/CreateStory.js')
const GetStories = require('./routes/GetStories.js')
const SubmitActivity = require('./routes/activity/SubmitActivity.js')
const DailyActivity = require('./routes/activity/DailyActivities.js')
const AddDiary = require('./routes/diary/AddDiary.js')
const GetUserDiary = require('./routes/diary/GetUserDiary.js')
const AddComment = require('./routes/AddComment.js')
const GetStoryComments = require('./routes/GetStoryComments.js')
const AddGuideEmail = require('./routes/user/AddGuideEmail.js')
const GetArticles = require('./routes/articles/GetArticles.js')
// Using imported middleware and routes
app.use(bodyParser.urlencoded({ extended: true }))
app.use(bodyParser.json())
app.use((req, res, next) => {
logger.request('New Request')
next()
})
app.use(CreateRoute)
app.use(GlobalUserIdentifier)
app.use(GetUser)
app.use(GetUserStories)
app.use(CreateStory)
app.use(GetStories)
app.use(SubmitActivity)
app.use(DailyActivity)
app.use(AddDiary)
app.use(GetUserDiary)
app.use(AddComment)
app.use(GetStoryComments)
app.use(AddGuideEmail)
app.use(GetArticles)
// require('./controllers/EmailAPI/test-email-setup.js')
const PORT = process.env.PORT
app.listen(PORT, () => {
logger.server('Server listening: 8080')
})