3.6. Microservice API

  • Wersjonowane

  • Stabilne

  • Deprecation policy

  • HTTP, REST, JSON

  • BFF, API Gateway

  • GraphQL

3.6.1. Direct

../../_images/microservices-api-direct.png

Figure 3.29. Source: [1]

3.6.2. API gateway

  • Implement an API gateway that is the single entry point for all clients. The API gateway handles requests in one of two ways. Some requests are simply proxied/routed to the appropriate service. It handles other requests by fanning out to multiple services.

  • Rather than provide a one-size-fits-all style API, the API gateway can expose a different API for each client. For example, the Netflix API gateway runs client-specific adapter code that provides each client with an API that's best suited to it's requirements.

  • The API gateway might also implement security, e.g. verify that the client is authorized to perform the request

  • Netflix API gateway, Zuur

../../_images/microservices-api-gateway.png

Figure 3.30. Source: [1]

3.6.3. BFF Model

../../_images/microservices-api-bff.png

Figure 3.31. Source: [1]

3.6.4. GraphQL

3.6.5. Historie

  • przykład stabilności webapi i mobilnych stron

  • wersjonowanie w nagłówkach HTTP i q=...

  • POST, PUT, PATCH, GET, DELETE

3.6.6. Further Reading

3.6.7. References