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

preview_player
Показать описание


(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
(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:

✅ Follow Me:

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
Рекомендации по теме
Комментарии
Автор

I've watched many NodeJS and express tutorials but the satisfaction I'm getting here, I didn't get before. It's more like I'm gaining confidence in learning the quality content. I first time watched your tutorial on free Code Camp and I decided to come over here.

divyanshsharma
Автор

a few years late but this was very very helpful, understood everything in this video

eddiebello
Автор

Thank you so much, Dave, great tutorial

MohammadBarghamadii
Автор

Too bad I can't give more than one like. Your teaching is excellent!

edwilsondasilva
Автор

Thank you dave, for providing us with such great tutorial. may God bless you.

quasi_verum
Автор

Separating routes into multiple files is great thing to consider even for small app as nobody knows how complex it can get as you work on it,

About Thunder Client extension, it looks more like Postman inside VSCode, but at least you don't have to leave your editor for testing your API,
unfortunately the request data is distributed in multiple places and you need to find your way through dozens of tabs to add/edit your params 😵.

I liked the plain text way that REST Client extension is using to create requests, it keeps me aware of all the headers needed to make a successful request instead of just implementing them for me automatically,

Looking forward for your next video, I always appreciate your way of organizing your code,
Thanks Dave 👍

ahmad-murery
Автор

It is so explained on each concept. I am waiting your advance mern stack project

sumantakumalik
Автор

Holy cow, Thunder Client is so convienient!

TheLucidWay
Автор

Okay lets get it straight and clear these tutorials are gold.

ashishafk
Автор

for the static css and js, I think it would be more simple to make only the root serve it and change all the js and css urls by adding a "/" at the beginning.

"style/style.css" => "/style/style.css"
"js/index.js" => "/js/index.js"

soniablanche
Автор

Great tutorial!! This is awesome. I'm grateful, it helped me so much

nicolasborges
Автор

I have a question: Why the object keys of the sent data must have " ". Can't they be without " " ? On React for example when I make a PUT request using the fetch() function, the body of the request does not need the " " for the data object keys. Thank you!

lazasergiu
Автор

Hi, I'd like to know which other extensions you use when coding nodejs applications

akbarganey
Автор

Im stuck on Multiple http methods per route and parameter values section.
my req.body is empty while calling post can anyone help me

arunkb
Автор

Hi, Dave! I'm at 22:08 working with Thunder Client right now in VS. I selected "Send" for the local host and it's stuck on processing. Would you happen to know the reason for this? Thanks!

Alibeee
Автор

Can you provide any solution export import of express router as in es6? It'll be helpful

motivational_shorts
Автор

am getting an issue, except the get method all other methods are not responding ..its not showing any content to the body

sagarsunil
Автор

I came from a background of using python and tornado, what I did was add `app.use(‘/myBaseRoute’, router.getMyBaseRoutes()` and within that file I parse the request.path and use a switch case to pass the route to the appropriate handler, the default being throwing a “route not found” error. Seems a lot cleaner to me honestly

gandalfgrey
Автор

when i send a post request on thunder client i just receive empty object as the response. but i already send the body same as in the video. how can i fix that?

agus-wesly
Автор

im doing internship in company and for nodejs and express im watching your video . i like how to teach and plz don`t do copy paste for small function or tell us where this code we can get . for cors you paste some code .. thank you

mayankpawar