-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
23 lines (19 loc) · 801 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
var express = require('express');
var app = express();
// Import controllers
var treesRoutes = require('./routes/treesRoutes');
var routeRoutes = require('./routes/routesRoutes');
var usersRoutes = require('./routes/usersRoutes');
var haltsRoutes = require('./routes/haltsRoutes');
app.use(function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', 'http://localhost:4200');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
res.setHeader('Access-Control-Allow-Credentials', true);
next();
});
app.use('/trees', treesRoutes);
app.use('/routes', routeRoutes);
app.use('/user', usersRoutes);
app.use('/halts', haltsRoutes);
module.exports = app;