DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

boxseb
boxseb

Posted on

Reminder about REST

GET

idempotent method to retrieve data out of API endpoint

200 returned when resource is found
404 returned when resource is not found
400 returned when a request is shaped incorrectly

POST

not idempotent creates new resource via API resource collection endpoint

201 should be returned containing created entity
200 or 204 returned when resource is created but cannot be identified by URI or returned in response body

PUT

used to update/replace resource addressed by resource identifier

200 or 204 returned to identify successful completion
201 returned when resource has been created
404 returned when resource not found

DELETE

used to delete resources addressed by resource identifier

200 returned when action has been performed and response contains status describing entity
202 returned when the action has been queued
204 returned when action has been performed but response does not contain status describing entity
404 returned when resource not found

PATCH

used to partially modify a resource

200 returned when action has been performed and response contains status describing entity
202 returned when the action has been queued
204 returned when action has been performed but response does not contain status describing entity
404 returned when resource not found

HEAD

used to find out based on response headers what response would be returned if GET method was used

Top comments (0)

An Animated Guide to Node.js Event Lop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.