Untitled
unknown
plain_text
2 years ago
543 B
8
Indexable
// CAMINHO DO ARQUIVO: SRC/CONTROLLERS/login.controller.js
const userAuthenticate = require('../helpers/authenticate');
const loginController = async (req, res) => {
const { email, password } = req.body;
if (!email || !password) {
return res.status(400).json({ message: 'Some required fields are missing' });
}
const token = await userAuthenticate(email, password);
if (!token) {
return res.status(400).json({ message: 'Invalid fields' });
}
return res.status(200).json({ token });
};
module.exports = loginController;Editor is loading...
Leave a Comment