i using passportjs authenticate simple web app. able store session , check whether user exists using req.user on pages making calls node server. however, there have static pages not making calls -- if guess url of these pages, they'd able app without authentication. how can authenticate these static pages through server?
you introduce authentication static files adding auth middleware route.
var jwt = require('express-jwt'); var auth = jwt({secret: 'secret', userproperty: 'payload'}); app.use(auth, express.static('public'));
if dont use jwt, custom function can passed instead of auth.
Comments
Post a Comment