M
M
myspace2017-03-12 00:10:37
JavaScript
myspace, 2017-03-12 00:10:37

Are such checks sufficient when dealing with sessions in node.js?

Is such a simple check for the existence of a session generally acceptable? is it possible to bypass it?

module.exports.dashboard = (req, res, next) => {

    if(!req.session.userId) {
        next();
    }

    let data = {
        title: 'Тайтл'
    };

    res.render('admin/index', data);
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2017-03-12
@myspace

Yes, such a check is enough. For more security, use this module .
To avoid asking such questions in the future, read this article .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question