Skip to content

Commit 232aaf0

Browse files
committed
Support extra middleware mounted after by calling next().
This is helpful if you want to add something like newrelic
1 parent 5db80eb commit 232aaf0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"body-parser": "^1.15.2",
1111
"express": "^4.14.0",
1212
"morgan": "^1.7.0",
13-
"react-dom": "16.4.1",
1413
"react": "16.4.1",
14+
"react-dom": "16.4.1",
1515
"yargs": "^3.29.0"
1616
},
1717
"peerDependencies": {

render.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Component.prototype.render = function render(props, toStaticMarkup, callback) {
6868
}
6969
};
7070

71-
app.post('/render', function service(request, response) {
71+
app.post('/render', function service(request, response, next) {
7272
var toStaticMarkup = request.body.to_static_markup || false;
7373
var pathToSource = request.body.path_to_source;
7474
var props = request.body.props || {};
@@ -91,12 +91,14 @@ app.post('/render', function service(request, response) {
9191

9292
component.render(props, toStaticMarkup, function(output) {
9393
response.send(output);
94+
next();
9495
});
9596
});
9697

9798
function errorHandler(err, request, response, next) {
9899
console.log('[' + new Date().toISOString() + '] ' + err.stack);
99100
response.status(500).send(argv.debug ? err.stack : err.toString());
101+
next();
100102
}
101103
app.use(errorHandler);
102104

0 commit comments

Comments
 (0)