Middleware
Day -3 of learning Web Dev
Today I stuided and practise middleware,
summarizing all the concepts:
→A request does not go straight to the route,it passes through some functions first. These functions are called middleware.
→Middleware is like a gatekeeper,it checks the request, stops it, or lets it go forward,next() means move ahead.
→If a middleware sends a response, it should not call next().
→Auth middleware decides early whether the user is allowed or not.
→req.body and req.query are just data sent by the client, not arguments or parameters.
→Express does not read JSON body automatically.
→If we don’t use express.json(), req.body becomes undefined.
→“Cannot read property of undefined” means the data never arrived because the data were never parsed.
##Backend_Engineering Day-3
#Day3 #WebDev #BackendEngineering #HTTP #CORS #HTTPS #APIs #SoftwareLearning #CodingJourney #DevLife
1
0 comments
Shoaib Khan
2
Middleware
powered by
Make $1k-$10k in 30 days
skool.com/make-1k-5k-in-30-days-8449
Media Valley School is the fastest way to hit $1K/month with freelancing or agency work. Guaranteed.
Land your first $1K month in 30 days
Build your own community
Bring people together around your passion and get paid.
Powered by