- What are the HTTP Methods in RESTful API and when would you use each of these?
- What does this HTTP Status codes represent?
- 1xx
- 2xx
- 3xx
- 4xx
- 5xx
- What is the difference between the following response functions?
- res.send()
- res.json()
- res.render()
- What are the appropriate status code for the following:
- Status Code OK
- Status Code Bad Request
- Status Code Unauthorized
- Status Code Forbidden
- Status Code Not Found
- Status Code Internal Server Error
Created
June 25, 2024 06:47
-
-
Save halitbatur/ad9cc9f7c27f7207a437f7ab44c74493 to your computer and use it in GitHub Desktop.
Rest Discussion
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Partners (Phamela and Sharon)
the primary methods and their typical uses:
getting details for a specific user.
forms or creating a new user
are supported for a resource (e.g, findin out if you can use GET, POST, etc, on a user resource).
Purpose: Request received, continuing process.
Example: 100 Continue - Request headers received, proceed with request body.
2xx (Success):
Purpose: Request successfully received, understood, and accepted.
Example: 200 OK - Request succeeded.
3xx (Redirection):
Purpose: Further action needed to complete the request.
Example: 301 Moved Permanently - Resource permanently moved to a new URL.
4xx (Client Error):
Purpose: Client-side error, bad request.
Example: 404 Not Found - Resource not found.
5xx (Server Error):
Purpose: Server-side error, failed to fulfill a valid request.
Example: 500 Internal Server Error - Server encountered an unexpected error.
res.send():
Purpose: Send a response of any type (HTML, text, JSON, etc.).
Use Case: General-purpose response sending.
res.json():
Purpose: Send a JSON response.
Use Case: Specifically for sending JSON data.
res.render():
Purpose: Render a view template.
Use Case: Generate and send HTML using a template engine.
Status Code Bad Request: 400
Status Code Unauthorized: 401
Status Code Forbidden: 403
Status Code Not Found: 404
Status Code Internal Server Error: 500