security helper for express. You can make all endpoints secure at once and control accessibility of each endpoint.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
package.json
readme.md
secure.me.js
sharedSession.js
signer.js

readme.md

secure.me - express helper that allows to setup security middleware for all routes at once

features

  • set security middleware on all routes at once
  • manage endpoints access by using setting up freeMiddleware

expamples

If you need to restrict access to all of your app's routes at once secure.secureRoutes(app);. You still can open routes for public by adding free middleware for the route.

var app = express();
var secure = secureMe();
//setup security/free middlewares
secure.setMiddlewares([freeAccess]);
secure.setDefault(ensureUser);

function ensureUser(req, res, next){
  // check the user next() if passed, 403 if not
}
function freeAccess(req, res, next){
  // setup guest user
  return next();
}

//secure routes
secure.secureRoutes(app);

app.get("/myprofile", showProfile);
app.get("/top", freeAccess, showTop);
app.get("/myProfileManage", manageProfile);
app.get("/shop", freeAccess, shop);

app.listen(PORT);

author

Eldar Djafarov djkojb@gmail.com

license

MIT