Skip to content

Commit

Permalink
Merge pull request #254 from rafaelrenanpacheco/patch-1
Browse files Browse the repository at this point in the history
Fix json body parse example
  • Loading branch information
vladgolubev authored Dec 4, 2018
2 parents 40c4f73 + c03bdb0 commit 87d5c48
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Let's assume you are building a JSON API to process a payment:
# handler.js

const middy = require('middy')
const { urlEncodeBodyParser, validator, httpErrorHandler } = require('middy/middlewares')
const { jsonBodyParser, validator, httpErrorHandler } = require('middy/middlewares')

// This is your common handler, in no way different than what you are used to doing every day
// in AWS Lambda
Expand Down Expand Up @@ -98,7 +98,7 @@ const inputSchema = {

// Let's "middyfy" our handler, then we will be able to attach middlewares to it
const handler = middy(processPayment)
.use(urlEncodeBodyParser()) // parses the request body when it's a JSON and converts it to an object
.use(jsonBodyParser()) // parses the request body when it's a JSON and converts it to an object
.use(validator({inputSchema})) // validates the input
.use(httpErrorHandler()) // handles common http errors and returns proper responses

Expand Down

0 comments on commit 87d5c48

Please sign in to comment.