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

Published: 21 September 2021
on channel: Dave Gray
39,343
1k

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:
   • Node.js Tutorials for Beginners  

🔗 Starter Source Code: https://github.com/gitdagray/express_...

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/d...
NPM CORS: https://www.npmjs.com/package/cors

✅ Follow Me:
Twitter:   / yesdavidgray  
LinkedIn:   / davidagray  
Blog: https://yesdavidgray.com
Reddit:   / 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


Watch video How to Setup Routes with Express Router | Node.js & Express tutorials for Beginners online without registration, duration hours minute second in high quality. This video was added by user Dave Gray 21 September 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 39,34 once and liked it 1 thousand people.