
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
brest-validate
Advanced tools
Validator wrapper around REST API library.
$ npm install brest-validator --save
In your application file, once you've created Brest instance
// Require brest library
const Brest = require('brest');
const BrestValidator = require('brest-validator');
//...
const brest = new Brest(require('./settings'), [BrestValidator]);
brest.on('ready', function(){
brest.use([]); //Required in Brest 0.4.7^
});
API scripts are expected to export object files with the following structure:
const resource = {
version: 1,
description: "Resource description", //Description for the Docker
endpoints: [
//Here come the endpoint objects
]
}
Add validator (or validate) method to the API description. Use express-validator notation.
const endpoint = {
/**
* Validation method. It is supposed to use express-validator (assertion part of it), but it can be
* also used as a custom validator. Any data returned by this method will be considered as an error message
*/
validator: function(req){
req.assert('fooId').notEmpty().isNumeric();
}
//...
}
##Changes
Updated to work with Brest 0.4.x branch
Copyright © 2013 Maxim Tovstashev max.kitsch@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Express validation wrapper for the bREST API
We found that brest-validate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.