I try to login. Well, when I consult the database to validate serch data, I request data in the matrix.
Code login.controller.ts
export async function postLogin(req: Request, res: Response): Promise<any>
{
const conn = await connect();
const user = await conn.query('SELECT Nombre from Usuario Where Nombre= ?', [req.body.Nombre])
if(!user[0])
{
return res.status(400).json('Usuario o Contraseña Invalidos');
}
else {
console.log('funciona');
}
return res.json('login');
}
I do not know how to validate that if the information is correct enter "works" and if you do not send the message 400.ja