The API endpoint to sign in a user is declared in the following route.
mern-skeleton/server/routes/auth.routes.js:
router.route('/auth/signin').post(authCtrl.signin)
When the Express app gets a POST request at '/auth/signin', it executes the signin controller function.
mern-skeleton/server/controllers/auth.controller.js:
const signin = (req, res) => { User.findOne({ "email": req.body.email }, (err, user) => { if (err || !user) return res.status('401').json({ error: "User not found" }) if (!user.authenticate(req.body.password)) { return res.status('401').send({ error: "Email and password don't match." }) } const token = jwt.sign({ _id: user._id }, config.jwtSecret) res.cookie("t", token, { expire: new Date() + 9999 }) return res.json({ ...