- Path Params: identify a specific resource of resources
- Query Params: soft/filter resources
Example: RESTful API endpoints for an entity called Car
- GET /cars
- GET /cars/:id
- POST /cars
- PUT /cars/:id
- DELETE /cars/:id
color is not a resource (a property of a resource)
delimiter & for more property
- GET /cars?color=blue
- GET /cars?color=blue&brand=ferrari
- All lowercases
- Hyphen separate words
- 200 for GET, PUT, POST, DELETE, ...
- 201 specifically for POST, PUT
- 204 for any methods, headers useful
- File: underscore
- Method: underscore
fetch() vs axios(): https://blog.logrocket.com/axios-vs-fetch-best-http-requests/
- Basic syntax
- Backward compatibility
- Response timeout
- Auto JSON data transform
- HTTP interceptor (change HTTP req from app to server, from server to app (e.g. logging, auth, retry failed HTTP req))
- Download progress
- Simultaneous reqs