Skip to content
Advertisement

Difficulties to make another route expressJS

I am doing a site as of my studies. The technology being free, I decided to code with nodejs/Express. For my first route /home, everything went well. But I can’t create others.

error message

Yet I thought I understood the system well. It would bother me if it was due to a silly error because I have been on this problem for too long πŸ˜‹.

index.js :

JavaScript

home_route.js :

JavaScript

home_controller.js :

JavaScript

constant_view.ejs :

JavaScript

And all this is very good. And now this is what does not work 😭.

auther_route.js :

JavaScript

auther_controller.js :

JavaScript

Thank you in advance for your time and your answers.

Advertisement

Answer

you are trying to reach the route /auther in index.js, but inside auther_route you create a route with /auther as well. So in index.js you should add /auther/auther or just change to app.use('/', require('./routes/auther_route'));

Regards

Advertisement