Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap

Learn how to setup routes with Express Router in this Node.js & Express tutorial for beginners. An Express JS app gets unorganized if you build it all in one file. Setup routes with Express Router to handle each route in its own file and organize your project.

Subscribe https://bit.ly/3nGHmNn

This lesson is part of an Node.js & Express for Beginners tutorial series playlist:
https://www.youtube.com/playlist?list=PL0Zuz27SZ-6PFkIxaJ6Xx_X46avTM1aYw

Starter Source Code: https://github.com/gitdagray/express_middleware

How to Setup Routes with Express Router | Node.js & Express tutorials for Beginners

(00:00) Intro
(00:05) Welcome
(00:15) Intro and Setup
(00:34) Creating a router
(04:36) Applying the router
(06:30) Applying static files to the routes
(08:16) Correction concerning app.use()
(09:25) Creating a second router
(12:28) Creating a REST API router
(16:23) Multiple http methods per route and parameter values
(19:51) Named parameter routes
(21:25) Testing the API routes
(24:26) Challenge - API route handlers

References:
Node.js Official site: https://nodejs.org
NPM Official site: https://www.npmjs.com/
Express JS Official site: https://expressjs.com/
MDN CORS: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
NPM CORS: https://www.npmjs.com/package/cors

Follow Me:
Twitter: https://twitter.com/yesdavidgray
LinkedIn: https://www.linkedin.com/in/davidagray/
Blog: https://yesdavidgray.com
Reddit: https://www.reddit.com/user/DaveOnEleven

Was this tutorial about how to set up routes and use the router in Express JS helpful? If so, please share. Let me know your thoughts in the comments.

#express #router #routes