Complete the code to import the Express module.
const express = require([1]);To use Express, you must import it with require('express').
Complete the code to create a new Express application.
const app = [1]();require() instead of express().http() which is not the Express app creator.You create an Express app by calling the express() function.
Fix the error in the GET route handler to send a response.
app.get('/hello', (req, res) => { res.[1]('Hello World'); });
res.write() without ending the response.res.end() without sending data.The res.send() method sends the response body to the client.
Fill both blanks to start the server on port 3000 and log a message.
app.listen([1], () => { console.[2]('Server running on port 3000'); });
console.error or console.info instead of console.log.The app.listen method starts the server on the given port. console.log prints the message.
Fill all three blanks to test the GET /hello endpoint using supertest.
import request from 'supertest'; import app from './app'; test('GET /hello returns Hello World', async () => { const response = await request(app).[1]('/hello'); expect(response.statusCode).toBe([2]); expect(response.[3]).toBe('Hello World'); });
post instead of get.response.text instead of response.body.Use request(app).get('/hello') to send a GET request. The status code for success is 200. The response body contains the returned string.
