-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackend_server.js
41 lines (28 loc) · 1.04 KB
/
backend_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
31
32
33
34
35
36
37
38
39
40
41
let express = require('express');
let app = express();
let morgan = require('morgan');
let config = require('./config/api_config');
let skillRoutes = require('./routes/skills');
let userRoutes = require('./routes/users');
let projectRoutes = require('./routes/projects');
let authRoutes = require('./routes/auth');
let contactRoutes = require('./routes/contact');
let authCheck = require('./inc/auth');
let port = process.env.PORT || config.port;
let bodyParser = require('body-parser');
let parseUrlencoded = bodyParser.urlencoded({extended: false});
let errorHandler = require('./inc/error-handler');
let crossSite = require('./inc/cross-site');
app.use(morgan('tiny'));
app.use(crossSite);
app.use(parseUrlencoded);
app.use(bodyParser.json());
app.use(authCheck.Init);
app.use('/auth', authRoutes);
app.use('/skills', skillRoutes);
app.use('/users', userRoutes);
app.use('/projects', projectRoutes);
app.use('/contact', contactRoutes);
app.use(errorHandler);
/* Start Server */
app.listen(port);