{"action":"created","issue":{"url":"https://api.github.com/repos/richardschneider/express-mung/issues/3","labels_url":"https://api.github.com/repos/richardschneider/express-mung/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/richardschneider/express-mung/issues/3/comments","events_url":"https://api.github.com/repos/richardschneider/express-mung/issues/3/events","html_url":"https://github.com/richardschneider/express-mung/issues/3","id":122895974,"number":3,"title":"The app does not respond after added express-mung middleware","user":{"login":"0angelic0","id":192781,"avatar_url":"https://avatars.githubusercontent.com/u/192781?v=3","gravatar_id":"","url":"https://api.github.com/users/0angelic0","html_url":"https://github.com/0angelic0","followers_url":"https://api.github.com/users/0angelic0/followers","following_url":"https://api.github.com/users/0angelic0/following{/other_user}","gists_url":"https://api.github.com/users/0angelic0/gists{/gist_id}","starred_url":"https://api.github.com/users/0angelic0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0angelic0/subscriptions","organizations_url":"https://api.github.com/users/0angelic0/orgs","repos_url":"https://api.github.com/users/0angelic0/repos","events_url":"https://api.github.com/users/0angelic0/events{/privacy}","received_events_url":"https://api.github.com/users/0angelic0/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-12-18T07:22:48Z","updated_at":"2015-12-20T01:23:54Z","closed_at":"2015-12-19T22:59:50Z","body":"If I move the express-mung as last middleware the app can respond but the function 'redact' (as the name from usage example) which I want to modify the response is not called.\r\n\r\nI used express generator to scaffold my app.\r\n\r\n\r\nCode below the app does not respond.\r\n```\r\napp.use(mung);\r\n\r\n// routes, users and api are express router\r\napp.use('/', routes);\r\napp.use('/users', users);\r\napp.use('/api', api);\r\n\r\n// catch 404 and forward to error handler\r\napp.use(function(req, res, next) {\r\n  var err = new Error('Not Found');\r\n  err.status = 404;\r\n  next(err);\r\n});\r\n\r\n// error handlers\r\n\r\n// development error handler\r\n// will print stacktrace\r\nif (app.get('env') === 'development') {\r\n  app.use(function(err, req, res, next) {\r\n    res.status(err.status || 500);\r\n    res.render('error', {\r\n      message: err.message,\r\n      error: err\r\n    });\r\n  });\r\n}\r\n\r\n// production error handler\r\n// no stacktraces leaked to user\r\napp.use(function(err, req, res, next) {\r\n  res.status(err.status || 500);\r\n  res.render('error', {\r\n    message: err.message,\r\n    error: {}\r\n  });\r\n});\r\n\r\nmodule.exports = app;\r\n```\r\n\r\nCode below the app can respond but function 'redact' is not called\r\n```\r\n// routes, users and api are express router\r\napp.use('/', routes);\r\napp.use('/users', users);\r\napp.use('/api', api);\r\n\r\n// catch 404 and forward to error handler\r\napp.use(function(req, res, next) {\r\n  var err = new Error('Not Found');\r\n  err.status = 404;\r\n  next(err);\r\n});\r\n\r\n// error handlers\r\n\r\n// development error handler\r\n// will print stacktrace\r\nif (app.get('env') === 'development') {\r\n  app.use(function(err, req, res, next) {\r\n    res.status(err.status || 500);\r\n    res.render('error', {\r\n      message: err.message,\r\n      error: err\r\n    });\r\n  });\r\n}\r\n\r\n// production error handler\r\n// no stacktraces leaked to user\r\napp.use(function(err, req, res, next) {\r\n  res.status(err.status || 500);\r\n  res.render('error', {\r\n    message: err.message,\r\n    error: {}\r\n  });\r\n});\r\n\r\napp.use(mung);\r\n\r\nmodule.exports = app;\r\n```"},"comment":{"url":"https://api.github.com/repos/richardschneider/express-mung/issues/comments/166050107","html_url":"https://github.com/richardschneider/express-mung/issues/3#issuecomment-166050107","issue_url":"https://api.github.com/repos/richardschneider/express-mung/issues/3","id":166050107,"user":{"login":"0angelic0","id":192781,"avatar_url":"https://avatars.githubusercontent.com/u/192781?v=3","gravatar_id":"","url":"https://api.github.com/users/0angelic0","html_url":"https://github.com/0angelic0","followers_url":"https://api.github.com/users/0angelic0/followers","following_url":"https://api.github.com/users/0angelic0/following{/other_user}","gists_url":"https://api.github.com/users/0angelic0/gists{/gist_id}","starred_url":"https://api.github.com/users/0angelic0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0angelic0/subscriptions","organizations_url":"https://api.github.com/users/0angelic0/orgs","repos_url":"https://api.github.com/users/0angelic0/repos","events_url":"https://api.github.com/users/0angelic0/events{/privacy}","received_events_url":"https://api.github.com/users/0angelic0/received_events","type":"User","site_admin":false},"created_at":"2015-12-20T01:23:54Z","updated_at":"2015-12-20T01:23:54Z","body":"Yes, your solution works perfectly. I comment this just to comfirm that. Sorry for late checking the issue.\r\n\r\nThank you for your help."}}