express helper that allows to setup security middleware for all routes at once
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 middlewaressecuresetSecurityensureUser;securesetFreefreeAccess;// 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 email@example.com