mardi 5 mai 2020

Express Next() return 404 not found

I'm new with express and I dont have to much idea about the error that im getting. I have a middleware in mi app.js file to get the api information but before getting the information I'm checking if the user is logged or not. If the user is logged I use the next() function to redirect the user to the next middleware but I'm getting a 404 error Not found. This is my middleware:

app.use('/api/advertisements',jwtAuth() ,require('./routes/api/advertisements'));

Code in jwtAuth();

module.exports = function(){ return (req, res, next) => { next(); }}

Thanks for the help.




Aucun commentaire:

Enregistrer un commentaire