Answers for "express static auth"

1

express static auth

app.use(function(req, res, next) {
    if (req.user == null && req.path.indexOf('/admin') === 0)
    {
        res.redirect('/login');
    }
    next(); 
});
Posted by: Guest on July-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language