- There are two general approaches to building web applications today:
- Use traditional web applications when:
- Your application's client-side requirements are simple or even read-only.
- Your application needs to function in browsers without JavaScript support.
- Use a SPA when:
- Your application must expose a rich user interface with many features.
- Your team is familiar with JavaScript, TypeScript, or Blazor WebAssembly development.
- Your application must already expose an API for other (internal or public) clients.
- This is can be controlled...
- REST APIs are all about data, no UI logic is exchanged.
- JSON is the common data format that is used both for requests and responses.
- REST APIs are decoupled from the clients that use them.
GET
- Get a Resource from the Server.PATCH
- Update parts of an existing Resource on the Server.POST
- Post a Resource to the Server (i.e. create or append Resource).PUT
- Put a Resource onto the Server (i.e. create or overwrite a Resource).DELETE
- Delete a Resource on the Server.OPTIONS
- Determine whether follow up Request is allowed (sent automatically).
- Uniform Interface
- Clearly defined API endpoints with clearly defined request + response data structure.
- Stateless Interactions
- Server and client don’t store any connection history, every request is handled seperately.
- Cacheable
- Servers may set caching headers to allow the client to cache responses.
- Client-Server
- Server and client are separated, client is not concerned with persistent data storage.
- Layered System
- Server may forward requests to other APIs.
- Code on Demand
- Executable code may be transferred from server to client,