Q3: How do the Express `req` and `res` objects relate to Node's native HTTP objects?
In Express, req (Request) and res (Response) are enhanced versions of Node's native http.IncomingMessage and http.ServerResponse prototypes.
Express adds helpful properties and helper functions directly onto these prototypes:
req.query,req.params,req.body,req.cookiesres.status(),res.json(),res.send(),res.sendFile(),res.cookie()
Key Takeaways
Express prototype-inherits from Node's HTTP stream classes.
You can still call standard Node native methods like
res.write()orres.end().