-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
27 lines (23 loc) · 840 Bytes
/
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
require('dotenv').config();
const express = require('express');
const bodyParser = require('body-parser');
const authRoutes = require('./routes/authRouter')
const userRoutes = require('./routes/userRoutes')
const tagRoutes = require('./routes/tagRoutes')
const blogRoutes = require('./routes/blogRoutes')
const likeRoutes = require('./routes/likeRoutes')
const commentRoutes = require('./routes/commentRouter')
const connectToDB = require('./config/dbConnection')
const port = process.env.PORT || 8080;
const app = express();
app.use(bodyParser.json())
connectToDB()
app.use('/auth', authRoutes)
app.use('/users', userRoutes)
app.use('/tags', tagRoutes)
app.use('/blogs', blogRoutes)
app.use('/likes', likeRoutes)
app.use('/comments', commentRoutes)
app.listen(port, () => {
console.log('Application is running on port ' + port)
})