-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
27 lines (21 loc) · 830 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
24
25
26
var express = require('express');
var app = express();
const bodyParser = require('body-parser');
global.__base = __dirname + '/';
const config = require(global.__base + 'server/helpers/configuration')();
app.use(function(req, res, next) {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Methods", "GET,POST");
res.setHeader("Access-Control-Allow-Headers", "Access-Control-Allow-Origin, Authorization, Content-Type");
next();
});
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
require(global.__base + 'server/routes/thermostat-routes')(app);
const compiledBundle = `${global.__base}/client/compiled`;
app.use(express.static(compiledBundle));
app.listen(config.port, function () {
console.log(`Running app on port ${config.port}!`);
});