Express routing, middleware, request and response objects, error handling, REST conventions, validation and authentication basics.
40 cards · basic cards · AI-written, checked twice. Edit anything.
- What does Express do?
Show answer
Framework for building web applications with Node.js
- What is routing in Express?
Show answer
Mapping HTTP requests to handler functions based on method and path
- What does app.listen() do?
Show answer
Starts the server and listens for incoming requests on a specified port
- What is a handler function?
Show answer
Function that receives req and res objects and processes a request
- How do you define a GET route?
Show answer
app.get(path, handler)
- How do you define a POST route?
Show answer
app.post(path, handler)
- How do you define a PUT route?
Show answer
app.put(path, handler)
- How do you define a DELETE route?
Show answer
app.delete(path, handler)
- What are route parameters?
Show answer
Named URL segments prefixed with a colon, like /users/:id
- How do you access route parameters?
Show answer
Through the req.params object
- What are query parameters?
Show answer
Key-value pairs appended to a URL after a question mark
- How do you access query parameters?
Show answer
Through the req.query object
- What does req.body contain?
Show answer
Parsed data sent in POST or PUT request bodies
- What does req.headers contain?
Show answer
HTTP headers sent by the client
- What does req.method return?
Show answer
The HTTP verb of the incoming request (GET, POST, etc.)