Untitled

 avatar
unknown
plain_text
2 years ago
452 B
10
Indexable
    app.post('/register', express.urlencoded(), async(req, res, next) => {

       const hashedPass = genPassword(req.body.password);

       try {
        const newUser = new User({
            username: req.body.username,
            email: req.body.email,
            password: hashedPass,
            admin: true
        })

        newUser.save();
       } catch (e) {
            console.error(e);
       }
       res.redirect('/login');
    });
Editor is loading...