|
1 | 1 | /* |
2 | 2 | ** HyperFlow engine |
3 | | -** Author: Bartosz Balis (2012-2014) |
| 3 | +** Author: Bartosz Balis (2012-2019) |
4 | 4 | ** |
5 | 5 | ** HyperFlow server implementing the REST API for HyperFlow workflows. |
6 | 6 | */ |
7 | 7 |
|
8 | 8 | 'use strict'; |
9 | 9 |
|
10 | | -/** |
11 | | - * Module dependencies. |
12 | | - */ |
13 | | - |
14 | 10 |
|
15 | 11 | var redisURL = process.env.REDIS_URL ? {url: process.env.REDIS_URL} : undefined; |
16 | 12 | // for express |
17 | 13 | var express = require('express'), |
| 14 | + bodyParser = require('body-parser'), |
18 | 15 | cons = require('consolidate'), |
19 | 16 | spawn = require('child_process').spawn, |
20 | 17 | http = require('http'), |
@@ -47,29 +44,14 @@ var contentType = 'text/html'; |
47 | 44 | //var baseUrl = 'http://localhost:'+process.env.PORT; |
48 | 45 | var baseUrl = ''; // with empty baseUrl all links are relative; I couldn't get hostname to be rendered properly in htmls |
49 | 46 |
|
50 | | -// Configuration |
51 | | -app.configure(function() { |
52 | | - //app.use(express.compress()); |
53 | | - app.engine('ejs', cons.ejs); |
54 | | - app.set('views', __dirname + '/views'); |
55 | | - app.set('view engine', 'ejs'); |
56 | | - app.use(express.bodyParser({strict: false})); |
57 | | - app.use(express.methodOverride()); |
58 | | - app.use(app.router); |
59 | | - app.use(express.static(__dirname + '/public')); |
60 | | - app.disable('strict routing'); |
61 | | -}); |
| 47 | +// parse application/x-www-form-urlencoded |
| 48 | +app.use(bodyParser.urlencoded({ extended: false })) |
62 | 49 |
|
63 | | -app.configure('development', function() { |
64 | | - app.use(express.errorHandler({ |
65 | | - dumpExceptions: true, |
66 | | - showStack: true |
67 | | - })); |
68 | | -}); |
| 50 | +// parse application/json |
| 51 | +app.use(bodyParser.json()) |
| 52 | + |
| 53 | +app.disable('strict routing'); |
69 | 54 |
|
70 | | -app.configure('production', function() { |
71 | | - app.use(express.errorHandler()); |
72 | | -}); |
73 | 55 |
|
74 | 56 | ///////////////////////////////////////////////////////////////// |
75 | 57 | //// REST API for HyperFlow workflows //// |
|
0 commit comments