express.json() do in an Express app?express.json() parses incoming requests with JSON payloads. It makes the JSON data available on req.body.
express.urlencoded() middleware help in handling form data?express.urlencoded() parses incoming requests with URL-encoded payloads, like form submissions. It makes form data accessible on req.body.
express.static() middleware?express.static() serves static files like images, CSS, and JavaScript from a folder. It helps deliver these files directly to the browser.
express.static() to serve files from a folder named public?You add app.use(express.static('public')) in your Express app. This makes files in public accessible via URLs.
express.json() and express.urlencoded() middleware before your route handlers?Because they parse the request body first, so your route handlers can easily access the data on req.body. Without them, req.body would be undefined.
express.json() is used to parse JSON payloads in requests.
express.urlencoded() parse?express.urlencoded() parses URL-encoded form data, like from HTML forms.
assets?express.static('assets') serves static files from the assets folder.
express.json() before accessing req.body for JSON data?Without express.json(), Express does not parse JSON, so req.body is undefined.
express.urlencoded() parses URL-encoded form data sent via POST.
express.json(), express.urlencoded(), and express.static() middleware work and when to use each.