0.5.2 • Published 7 years ago

@nicolasparada/bodyparser-middleware v0.5.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

@nicolasparada/bodyparser-middleware npm version dependencies

Body Parser Middleware.

Usage

const framework = require('@nicolasparada/web-framework')
const bodyparser = require('@nicolasparada/bodyparser-middleware')

const app = framework()

app.post('/json', bodyparser.json(), req => req.body)
app.post('/multipart', bodyparser.multipart(), req => {
  // Files are at req.files
  return req.body
})

app.listen(80, '127.0.0.1', () => {
  console.log('Make a POST request to http://localhost/echo-body')
})

Options

JSON

  • limit {number} Maximum bytes to parse. Defaults to (1024 ** 2) * 100 (1mB).
  • types {string[]} 'Content-Type' headers to handle. Defaults to:
    • application/json
    • application/json-patch+json
    • application/vnd.api+json
    • application/csp-report

MULTIPART

The multipart body parser uses formidable, so you can pass any options supported by it.

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago