ziploc-request-parser
v1.0.1
Published
An extension for ziploc that parses express requests
Downloads
3
Maintainers
Readme
ziploc-request-parser
This package provides an extension to ziploc and express to parse requests.
var ziploc = require('ziploc');
var express = require('express');
var requestParser = require('ziploc-request-parser');
var zip = ziploc
.use(requestParser)
.use({
getUsernameFromUnvalidatedUsername: function (username) {
// todo: do your input validation here
return username;
}
});
var app = express();
app.use(requestParser);
app.get('/users/:username', zip.express().status(200).json({
username: 'Username'
}));
app.listen(process.env.PORT || 3000);