parse-post
A function that wraps ordinary request handler and automatically parse posts. It also protects again nuke requests.
Currently works with node.js v0.10.1+.
Examples
var parse_post = ; var route = beeline; http;
Example uses beeline.
The API
require("parse-post")
-- Returns a function that expects a node.js request object and a node.js response object as the first and second parameters.require("parse-post").config(opt)
-- Creates a new version ofparse-post
configured with values in byopt
:opt.parser
-- A function that's used to parse the contents of the parse body. Defaulted torequire("querystring").parse
opt.limit
-- Defines the maximum size in bytes of a post request. Defaulted to1e6
.opt.message
-- Error message sent as response body when post request is overopt.limit
. Defaulted to "Too much".opt["error-content-type"]
-- Content type of the response sent when the post request is overopt.limit
. Defaulted totext/plain
.
Getting parse-post
The easiest way to get parse-post is with npm:
npm install parse-post
Alternatively you can clone this git repository:
git clone git://github.com/xavi-/node-parse-post.git
Developed by
- Xavi Ramirez
License
This project is released under The MIT License.