-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
30 lines (23 loc) · 888 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
const express = require('express')
const app = express()
const bodyParser = require('body-parser')
const clientRoute = require('./server/routes/client')
const profRoute = require('./server/routes/prof')
const generalRoute = require('./server/routes/general')
const authRoute = require('./server/routes/auth')
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended: false}))
app.use(function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*')
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS')
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With')
next()
})
app.use('/client',clientRoute)
app.use('/prof',profRoute)
app.use('/general',generalRoute)
app.use('/auth',authRoute)
const port = 5000
app.listen(port, function(){
console.log('server is running')
})