Socket
Socket
Sign inDemoInstall

parse-post

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    parse-post

A function that wraps ordinary request handler and automatically parse posts. It also protects again nuke requests.


Version published
Weekly downloads
5
increased by150%
Maintainers
1
Install size
4.10 kB
Created
Weekly downloads
 

Readme

Source

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 = require("parse-post");

var route = beeline.route({
	"/": function(req, res) {
		"GET": function(req, res) { /*** GET Code ***/ },
		"POST": parse_post(function(req, res) {
			// req.body has parsed POST request body
		})
	}
});

http.createServer(route).listen(8014);

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 of parse-post configured with values in by opt:
    • opt.parser -- A function that's used to parse the contents of the parse body. Defaulted to require("querystring").parse
    • opt.limit -- Defines the maximum size in bytes of a post request. Defaulted to 1e6.
    • opt.message -- Error message sent as response body when post request is over opt.limit. Defaulted to "Too much".
    • opt["error-content-type"] -- Content type of the response sent when the post request is over opt.limit. Defaulted to text/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.

Keywords

FAQs

Last updated on 03 Feb 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc