express-parsers
v1.0.2
Published
POST, URL, COOKIE parser for ExpressJS.
Downloads
3
Maintainers
Readme
How i can use this package in my express project?
First, install package into your project
npm i express-parsers
After installing import intro your code
const ExpressParsers = require('express-parsers');
After importing you must configure with your express
const express = require('express');
const parsers = new ExpressParsers(express);
After that you can use your project with like that:
// Parse cookies
app.use(parsers.Cookie);
// Saves cookies to res.locals.cookie
// Parse POST request body
// If you has some configration with Express.json you can add that with like that
parsers.Body = {
/* Some magic here too */
}
app.user(parsers.Body)
// Parse GET request url data parser
// If you has some configration with Express.urlencoded you can add that with like that
parsers.URL = {
extended: true
/* Some magic here too */
}
app.use(parser.URL);