0
0
Expressframework~5 mins

Creating a basic Express server - Quick Revision & Summary

Choose your learning style9 modes available
Recall & Review
beginner
What is Express in Node.js?
Express is a simple and flexible web framework for Node.js that helps you build web servers and APIs easily.
Click to reveal answer
beginner
Which method creates an Express application?
The method express() creates an Express application instance.
Click to reveal answer
beginner
How do you make an Express server listen on port 3000?
Use app.listen(3000, () => { console.log('Server running on port 3000') }) to start the server on port 3000.
Click to reveal answer
beginner
What does app.get('/', (req, res) => { ... }) do?
It defines a route handler for GET requests to the root URL '/' and sends a response back to the client.
Click to reveal answer
beginner
Why do we use res.send() in Express?
res.send() sends a response back to the client, like text or HTML, to show in the browser.
Click to reveal answer
Which line creates a new Express app?
Aconst app = express();
Bconst app = new Express();
Cconst app = require('express');
Dconst app = express.createApp();
How do you define a route for GET requests to '/'?
Aapp.post('/', (req, res) => { ... });
Bapp.listen('/', () => { ... });
Capp.route('/', 'GET', () => { ... });
Dapp.get('/', (req, res) => { ... });
What does app.listen(3000) do?
ASends a response to port 3000
BStops the server on port 3000
CStarts the server on port 3000
DCreates a new route on port 3000
Which object represents the incoming request in a route handler?
Areq
Bres
Capp
Dserver
Which method sends a response back to the client?
Aserver.send()
Bres.send()
Capp.send()
Dreq.send()
Explain how to create a basic Express server that responds with 'Hello World' on the root URL.
Think about the steps from importing Express to starting the server.
You got /5 concepts.
    Describe the roles of the 'req' and 'res' objects in an Express route handler.
    One is for input, the other for output.
    You got /3 concepts.