-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathserver.js
39 lines (29 loc) · 1.04 KB
/
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
//Install express server
const express = require('express');
const path = require('path');
var workflow = require('./server/workflow');
var bodyParser = require('body-parser');
var methodOverride = require('method-override');
var cors = require('cors');
const app = express();
const PORT = 8080;
// Serve only the static files form the dist directory
app.use(express.static(__dirname + '/dist/ch-ui'));
app.disable('x-powered-by');
app.use(bodyParser.urlencoded({
'extended': 'true'
})); // parse application/x-www-form-urlencoded
app.use(bodyParser.json()); // parse application/jso
app.use(bodyParser.json({
type: 'application/vnd.api+json'
})); // parse application/vnd.api+json as json
app.use(methodOverride());
app.use(cors({origin: '*'}));
app.use('/workflows', workflow);
// app.get('/*', function(req,res) {
// res.sendFile(path.join(__dirname+'/dist/ch-ui/index.html'));
// });
// Start the app by listening on the default Heroku port
app.listen(process.env.PORT || PORT, () => {
console.log('server started on port: ' + PORT);
});