-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
25 lines (19 loc) · 786 Bytes
/
Copy pathserver.js
File metadata and controls
25 lines (19 loc) · 786 Bytes
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
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var apiController = require('./controllers/apiController');
var htmlController = require('./controllers/htmlController');
var port = process.env.PORT || 8000;
//Allow all requests from all domains & localhost
app.all('/*', function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, Accept");
res.header("Access-Control-Allow-Methods", "POST, GET");
next();
});
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false, limit: '10mb'}));
app.use(express.static(__dirname + '/public'));
htmlController(app, __dirname);
apiController(app, __dirname);
app.listen(port);