req-requires
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -19,9 +19,5 @@ var requiredProperty = require('./requiredProperty'); | ||
this.property = function(name){ | ||
return new requiredProperty(this, name); | ||
return new requiredProperty(req, name); | ||
} | ||
this.getValue = function(propertyName){ | ||
return getPropertyValue(req, propertyName); | ||
} | ||
this.fail = function(message){ | ||
@@ -28,0 +24,0 @@ this.error = message; |
{ | ||
"name": "req-requires", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Add assertions to ExpressJS middleware", | ||
@@ -5,0 +5,0 @@ "main": "./lib/req-requires.js", |
@@ -32,2 +32,20 @@ **req-requires.js** is a library that is used to validate properties on the request object in expressjs route handlers. | ||
***Example of a failing request*** | ||
``` | ||
Example Request: | ||
GET: http://localhost:3000/testRoute | ||
Example Response | ||
400: Expected query.name to exist | ||
``` | ||
***Example of a passing request*** | ||
``` | ||
Example Request: | ||
GET: http://localhost:3000/testRoute?name=brandon | ||
Example Response | ||
200: Hello brandon! | ||
``` | ||
### Validators | ||
@@ -34,0 +52,0 @@ ```javascript |
Sorry, the diff of this file is not supported yet
56
4165
6
70