-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
23 lines (17 loc) · 755 Bytes
/
Copy pathmain.js
File metadata and controls
23 lines (17 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const express = require('express')
const bodyParser = require('body-parser')
const cors = require('cors');
require('dotenv').config()
const userRouter = require('./routers/userRouter')
const recipeRouter = require('./routers/recipeRouter')
const db = require('./db/index')
const app = express()
app.use(cors()) //should be changed in the future to a specific address
app.use(bodyParser.json({ limit: '50mb', extended: true }));
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }))
db.on('error', console.error.bind(console, 'MongoDB connection error:'))
app.use('/userapi', userRouter)
app.use('/recipeapi', recipeRouter)
app.listen(process.env.PORT, () => {
console.log(`Server listening at http://localhost:${process.env.PORT}`)
});