-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
26 lines (20 loc) · 769 Bytes
/
Copy pathserver.js
File metadata and controls
26 lines (20 loc) · 769 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
26
var express = require('express'),
app = express(),
port = process.env.PORT || 3000,
bodyParser = require('body-parser');
app.all('/*', function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
res.header("Access-Control-Allow-Methods", "PUT");
res.header("Access-Control-Allow-Headers", "Content-Type");
next();
});
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
//app.use(function(req, res) {
// res.status(404).send({url: req.originalUrl + ' not found'})
//});
var routes = require('./api/routes/rangeHoodControlRoutes');
routes(app);
app.listen(port);
console.log('Range Hood Controller RESTful API server started on: ' + port);