A Twitch.tv viewer reward and games system.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.0 KiB

  1. # Body Parser [![Build Status](https://travis-ci.org/expressjs/body-parser.png)](https://travis-ci.org/expressjs/body-parser)
  2. Connect's body parsing middleware.
  3. ## API
  4. ```js
  5. var bodyParser = require('body-parser');
  6. var app = connect();
  7. app.use(bodyParser());
  8. app.use(function (req, res, next) {
  9. console.log(req.body) // populated!
  10. next();
  11. })
  12. ```
  13. ### bodyParser([options])
  14. Returns middleware that parses both `json` and `urlencoded`. The `options` are passed to both middleware.
  15. ### bodyParser.json([options])
  16. Returns middleware that only parses `json`. The options are:
  17. - `strict` <true> - only parse objects and arrays
  18. - `limit` <1mb> - maximum request body size
  19. - `reviver` - passed to `JSON.parse()`
  20. ### bodyParser.urlencoded([options])
  21. Returns middleware that only parses `urlencoded` with the [qs](https://github.com/visionmedia/node-querystring) module. The options are:
  22. - `limit` <1mb> - maximum request body size
  23. ## License
  24. The MIT License (MIT)
  25. Copyright (c) 2014 Jonathan Ong me@jongleberry.com
  26. Permission is hereby granted, free of charge, to any person obtaining a copy
  27. of this software and associated documentation files (the "Software"), to deal
  28. in the Software without restriction, including without limitation the rights
  29. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  30. copies of the Software, and to permit persons to whom the Software is
  31. furnished to do so, subject to the following conditions:
  32. The above copyright notice and this permission notice shall be included in
  33. all copies or substantial portions of the Software.
  34. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  36. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  37. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  38. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  40. THE SOFTWARE.