Comparing version 0.0.1-pre4 to 0.0.1-pre5
@@ -75,13 +75,13 @@ var Joi = require('joi'); | ||
} | ||
} | ||
if (validate.response) { | ||
var send = res.send; | ||
res.send = function(body) { | ||
var status = self.validator.validate(body, validate.response); | ||
if (status.error) { | ||
return handleFailure(status); | ||
if (validate.response) { | ||
var send = res.send; | ||
res.send = function(body) { | ||
var status = self.validator.validate(body, validate.response); | ||
if (status.error) { | ||
return handleFailure(status); | ||
} | ||
return send(status.body); | ||
} | ||
return send(status.body); | ||
} | ||
@@ -88,0 +88,0 @@ } |
{ | ||
"name": "conformity", | ||
"version": "0.0.1-pre4", | ||
"version": "0.0.1-pre5", | ||
"description": "JSON validation middleware for express.js, kitchensink, etc", | ||
@@ -25,3 +25,6 @@ "main": "index.js", | ||
], | ||
"author": "Van Nguyen <thegoleffect@gmail.com>", | ||
"author": { | ||
"name": "Van Nguyen", | ||
"email": "thegoleffect@gmail.com" | ||
}, | ||
"license": "MIT", | ||
@@ -31,3 +34,13 @@ "dependencies": { | ||
"xss": "^0.2.10" | ||
} | ||
}, | ||
"readme": "# Conformity - HTTP Parameter Validation Middleware\n\n[![Dependency Status](https://david-dm.org/thegoleffect/conformity.svg)](https://david-dm.org/thegoleffect/conformity.svg)\n[![devDependency Status](https://david-dm.org/thegoleffect/conformity/dev-status.svg)](https://david-dm.org/thegoleffect/conformity/dev-status.svg)\n\nConformity is a JSON validation middleware for express.js. It lets you perform path, query, payload, and response validation without polluting your handler code. Additionally, it performs XSS html escaping automatically.\n\n## Getting Started\n\n```\nnpm install --save conformity\n```\n\n\n```\nvar Express = require('express');\nvar Conformity = require('conformity');\nvar Joi = Conformity.validator;\n\nvar app = Express();\n\n// CONFORMITY USAGE:\napp.use(Conformity.validate());\nvar IndexHandler = function (req, res) {\n return 'Hello! ' + req.params.name;\n}\nIndexHandler.validate = {\n path: {\n name: Joi.string().required()\n }\n};\n\napp.get('/:name', IndexHandler);\n\napp.listen(3000);\n```", | ||
"readmeFilename": "README.md", | ||
"gitHead": "db386179e4a1479f6d6c16ea395693cf55144631", | ||
"bugs": { | ||
"url": "https://github.com/thegoleffect/conformity/issues" | ||
}, | ||
"homepage": "https://github.com/thegoleffect/conformity", | ||
"_id": "conformity@0.0.1-pre5", | ||
"_shasum": "fedb519750687cfb022b9e9a32592e0abb871b63", | ||
"_from": "conformity@0.0.1-pre5" | ||
} |
@@ -6,2 +6,32 @@ # Conformity - HTTP Parameter Validation Middleware | ||
Conformity is... | ||
Conformity is a JSON validation middleware for express.js. It lets you perform path, query, payload, and response validation without polluting your handler code. Additionally, it performs XSS html escaping automatically. | ||
## Getting Started | ||
``` | ||
npm install --save conformity | ||
``` | ||
``` | ||
var Express = require('express'); | ||
var Conformity = require('conformity'); | ||
var Joi = Conformity.validator; | ||
var app = Express(); | ||
// CONFORMITY USAGE: | ||
app.use(Conformity.validate()); | ||
var IndexHandler = function (req, res) { | ||
return 'Hello! ' + req.params.name; | ||
} | ||
IndexHandler.validate = { | ||
path: { | ||
name: Joi.string().required() | ||
} | ||
}; | ||
app.get('/:name', IndexHandler); | ||
app.listen(3000); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
7394
36