g4js-firewall
Simple pattern based firewall that supports roles and HTTP methods.
Install
$ npm install g4js-firewall
Usage
Require the module:
var Firewall = Firewall;
Add some rules:
var firewall = ; // admin path restricted to admin role with all methods allowedfirewall; // admin path restricted to admin role with all methods allowedfirewall; // signup path restricted to readonly role using POST methodfirewall; // shop path restricted to readonly role using GET methodfirewall;
Run some checks:
// returns matching rule if match foundvar matchingRule = firewall; // returns undefined if no matching rules foundvar noBueno = firewall; // express middleware coming soon...
License
Contribute
Pull Requests always welcome, as well as any feedback or issues. Made with OSS <3 and brought to you by #teamgorgeous.