How to Pass Data Through Middleware in Express JS

preview_player
Показать описание
Learn how to pass data through middleware functions in Express JS with this quick and easy tutorial.

Resources:
-----------------
-----------------
Thumbnail Background Photo by Markus Spiske on Unsplash
Комментарии
Автор

This tutorial is wonderful. You really do a great job of explaining concepts and simplifying it even for beginners. Thank you!

samantharivera-vigp
Автор

I'm an Express beginner and this tutorial was wonderful! Great job explaining the concepts and thank you!

aimeewildstone
Автор

Thanks! I've been struggling with an Express project with relatively complex MVC structure and res.locals saved me!

grigoryegorov
Автор

i have a questuon.i have 2 route
FIRST
app.get('/user', (req, res){
req.user '' i want req.user to send second route
})


SECOND
app.put('/product'(req, res){
i want to use here
}
)

how can i do this

ulmwfue
Автор

Really great tutorial. Make more of these please!

slimyelow
Автор

Wow! Thank you, sir. You and Traversy Media have been helpful.I've just subscribe to you.

DaggieBlanqx
Автор

Hey Ian, why for the Post.findById(req.params.id) you use 'id' and for the if statement post.author._id you use '_id'? What is the difference between id and _id? Thanks in advance.

unanimous
Автор

Really nice ! Was looking exactly for that :D

Layce
Автор

How would this relate to the "put" route of an edit where I currently still use the mongoose method "findByIdAndUpdate"?

MathijsGroothuis
Автор

Hey Ian, I'm using express-handlebars for a project. Is there a way to modify the res.locals or app.locals object from the client side? My goal is conditionally render html based off of form selection options.

Brian-dddf