Complete the code to import the Express library.
const express = require('[1]');
The Express library is imported using require('express').
Complete the code to define a POST route that expects JSON data.
app.post('/data', (req, res) => { const userData = req.[1]; res.send('Received'); });
The JSON data sent in a POST request is accessed via req.body.
Fix the error in the response to send JSON data correctly.
res.[1]({ message: 'Success' });
Use res.json() to send a JSON response with the correct headers.
Fill both blanks to validate request data and send an error response if invalid.
if (!req.body.name || typeof req.body.name !== '[1]') { return res.status([2]).json({ error: 'Name is required and must be a string' }); }
The code checks if name is a string and sends a 400 Bad Request status if not.
Fill all three blanks to create a response schema that sends user info with id, name, and active status.
res.json({
id: req.body.[1],
name: req.body.[2],
active: req.body.[3]
});The response sends userId, name, and active fields from the request body.
