routes Archives - wiki

Nodejs Express separate routes

Move the rout definition from the index.js or app.js

Folder structure

node structure

index.js file

 

routes.js

you can add more routs like admin routs (*i am not added this in my project so it will not see int the above folder structure)

adminroutes.js

 

ref: https://expressjs.com/en/guide/routing.html

4 Likes
By bm on August 2, 2016 | Express, NodeJs | A comment?
Tags: , ,