Fixing formatting, using express.Request since it is now extended properly

This commit is contained in:
Eric Byers
2015-04-29 12:24:00 -05:00
parent 07c9cecd7d
commit 573cd80b1c
+5 -5
View File
@@ -9,7 +9,7 @@ var app = express();
app.use(expressValidator());
app.post('/:urlparam', function(req: expressValidator.ValidatedRequest, res: express.Response) {
app.post('/:urlparam', function(req: express.Request, res: express.Response) {
// checkBody only checks req.body; none of the other req parameters
// Similarly checkParams only checks in req.params (URL params) and
@@ -17,17 +17,17 @@ app.post('/:urlparam', function(req: expressValidator.ValidatedRequest, res: exp
req.checkBody('postparam', 'Invalid postparam').notEmpty().isInt();
req.checkParams('urlparam', 'Invalid urlparam').isAlpha();
req.checkQuery('getparam', 'Invalid getparam').isInt();
req.checkHeader('testHeader', 'Invalid testHeader').isLowercase().isUppercase();
req.checkFiles('testFiles', 'Invalid testFiles').isUrl();
req.checkHeader('testHeader', 'Invalid testHeader').isLowercase().isUppercase();
req.checkFiles('testFiles', 'Invalid testFiles').isUrl();
// OR assert can be used to check on all 3 types of params.
// OR assert can be used to check on all 3 types of params.
// req.assert('postparam', 'Invalid postparam').notEmpty().isInt();
// req.assert('urlparam', 'Invalid urlparam').isAlpha();
// req.assert('getparam', 'Invalid getparam').isInt();
req.sanitize('postparam').toBoolean();
req.filter('postparam').toBoolean();
req.filter('postparam').toBoolean();
var errors = req.validationErrors();
var mappedErrors = req.validationErrors(true);