2.6. Microservice API

  • Wersjonowane

  • Stabilne

  • Deprecation policy

  • HTTP, REST, JSON

  • BFF, API Gateway

  • GraphQL

2.6.1. Direct

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

Figure 2.10. Source: 1

2.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 2.11. Source: 1

2.6.3. BFF Model

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

Figure 2.12. Source: 1

2.6.4. GraphQL

2.6.5. Historie

  • przykład stabilności webapi i mobilnych stron

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

  • POST, PUT, PATCH, GET, DELETE

2.6.6. Further Reading

2.6.7. References

1(1,2,3)

TDA Corporation. BFF - Backend for frontend. Year: 2020. Retrieved: 2022-03-28. URL: https://blog.tda.company/bff-backend-for-frontend/