express helper that allows to setup security middleware for all routes at once
- set security middleware on all routes at once
- manage endpoints access by using setting up freeMiddleware
If you need to restrict access to all of your app's routes at once
You still can open routes for public by adding free middleware for the route.
var app = express;var secure = secureMe;//setup security/free middlewaressecuresetMiddlewaresfreeAccess;securesetDefaultensureUser;// check the user next() if passed, 403 if not// setup guest userreturn next;//secure routessecuresecureRoutesapp;appget"/myprofile" showProfile;appget"/top" freeAccess showTop;appget"/myProfileManage" manageProfile;appget"/shop" freeAccess shop;applistenPORT;
Eldar Djafarov firstname.lastname@example.org