0
0
Node.jsframework~5 mins

Status code usage patterns in Node.js - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does HTTP status code 200 mean?
Status code 200 means "OK". It indicates that the request was successful and the server returned the requested data.
Click to reveal answer
beginner
When should you use status code 201 in a Node.js API?
Use status code 201 "Created" when a new resource has been successfully created, such as after a POST request that adds data.
Click to reveal answer
intermediate
What is the difference between status codes 400 and 404?
Status code 400 "Bad Request" means the client sent invalid data or malformed request. Status code 404 "Not Found" means the requested resource does not exist on the server.
Click to reveal answer
beginner
Why use status code 500 in your Node.js server responses?
Status code 500 "Internal Server Error" signals that something went wrong on the server side, like an unexpected error or exception.
Click to reveal answer
beginner
What status code should you use to indicate unauthorized access?
Use status code 401 "Unauthorized" when the client needs to authenticate or provide valid credentials to access the resource.
Click to reveal answer
Which status code indicates a successful GET request?
A200
B404
C500
D301
What status code should you return after successfully creating a new user?
A201
B404
C403
D400
If a client sends a request with missing required fields, which status code fits best?
A200
B400
C401
D500
Which status code means the requested page or resource was not found?
A401
B200
C201
D404
What status code should be used when the server encounters an unexpected error?
A301
B403
C500
D200
Explain when and why you would use HTTP status codes 200, 201, 400, 401, 404, and 500 in a Node.js API.
Think about common client-server interactions and errors.
You got /6 concepts.
    Describe how proper use of status codes improves communication between a client and a Node.js server.
    Consider how a client reacts to different server responses.
    You got /4 concepts.