foundersandcoders / express-handlebars-workshop

7 stars 10 forks source link

Unnecessary use of express.Router #24

Open oliverjam opened 5 years ago

oliverjam commented 5 years ago

I've been using Express professionally for 2 years and I don't think I've ever used express.Router instead of setting up routes directly on app.

This confused me reading this workshop so I'm sure it's confusing to students who just learnt the basics of setting up a server the day before.

If we want to keep the separate router in there we should explain why we're using that (I guess to modularise the routing?). We'll also need to explain about middleware being set at the "app" level versus the "router" level.

To be honest my preference would be to keep it simple and just put all the routes on app. There are only 2 routes and 2 error handlers in the router anyway 🤷‍♀️

astroash commented 5 years ago

@oliverjam yup makes sense!