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