Complete the code to import the Express framework.
const express = require('[1]');
The Express framework is imported by requiring the 'express' module.
Complete the code to create a new Express application instance.
const app = [1]();Calling the imported 'express' function creates a new Express app instance.
Fix the error in the middleware setup to parse JSON request bodies.
app.use(express.[1]());To parse JSON bodies, use the 'json' middleware from Express.
Fill both blanks to parse URL-encoded form data with extended option set to false.
app.use(express.[1]({ extended: [2] }));
Use 'urlencoded' middleware with the option 'extended: false' to parse form data simply.
Fill all three blanks to create a POST route that reads JSON data from the request body and sends back a message with the user's name.
app.post('/hello', (req, res) => { const name = req.body.[1]; res.send(`Hello, ${ [2] }! Your ID is ${req.body.[3].`); });
The code reads the 'name' property from the JSON body and sends a greeting including the 'id'.