Skip to content

Commit

Permalink
Merge pull request #161 from Medium/nick-config
Browse files Browse the repository at this point in the history
Add mechanisms to configure middleware
  • Loading branch information
nicks committed Feb 17, 2015
2 parents ebc7562 + 910a1f2 commit 154a7b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "matador",
"description": "an MVC framework for Node",
"version": "2.0.0-alpha.8",
"version": "2.0.0-alpha.9",
"homepage": "https://github.com/Medium/matador",
"main": "src/matador.js",
"authors": [
Expand Down
6 changes: 3 additions & 3 deletions src/matador.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,14 @@ var createApp = function (baseDir, configuration) {

// stupid body parser is stupid (doesn't check for http method in current
// connect version, manually create body parser from the 3 child methods)
var jsonParser = connect.json({limit: '10mb'})
var jsonParser = connect.json(app.get('configMiddlewareJson', {limit: '10mb'}))
app.use(function (req, res, next) {
req.body = {}
if (req.method == 'GET' || req.method == 'HEAD') return next()
return jsonParser(req, res, next)
})
app.use(connect.urlencoded({limit: '10mb'}))
app.use(connect.multipart())
app.use(connect.urlencoded(app.get('configMiddlewareUrlEncoded', {limit: '10mb'})))
app.use(connect.multipart(app.get('configMiddlewareMultipart', null)))

app.use(preRouter.bind(null, app))

Expand Down

0 comments on commit 154a7b4

Please sign in to comment.