https://github.com/primaryobjects/easypost-lib
Easy method for reading POST data in Node.js web applications. Supports form submissions and REST client posts. Provides a single location for maintaining the code that reads POST data.
https://github.com/primaryobjects/easypost-lib
Last synced: 7 months ago
JSON representation
Easy method for reading POST data in Node.js web applications. Supports form submissions and REST client posts. Provides a single location for maintaining the code that reads POST data.
- Host: GitHub
- URL: https://github.com/primaryobjects/easypost-lib
- Owner: primaryobjects
- License: mit
- Created: 2012-11-12T17:27:28.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2012-11-29T15:44:20.000Z (about 13 years ago)
- Last Synced: 2025-06-20T09:45:01.672Z (7 months ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
EasyPost
--------
An easy method for reading POST data in Node.js web applications. EasyPost supports both form submissions and REST client posts. It also provides a single location for maintaining the code that reads POST data, allowing you to enhance it, such as with checks for flooding attacks, etc.
```bash
$ npm install easypost
```
## Usage
```
var easypost = require('easypost');
```
### Reading POST Data From a Form
```
easypost.get(req, res, function (data) {
res.render('index', { txtName: data.txtName });
});
```
### Reading POST Data From a REST Client
```
easypost.get(req, res, function (data) {
data = JSON.parse(data);
res.render('index', { txtName: data.txtName });
});
```
## Notes
In the above examples, the first example assumes your form contains the element:
```
[input type='text' id='txtName' /]
```
The second example assumes a REST client has posted the following data:
```
{"txtName": "My Name"}
```
You can view a tutorial article using EasyPost at http://www.primaryobjects.com/CMS/Article144.aspx
## Author
Kory Becker
http://www.primaryobjects.com