Reputation: 11
I have a service written in Kotlin which has GRPC API's written in it. I want to know can there be graphQL endpoints in the same service or a new service should be created for it. Will it be possible for clients to access both grpc endpoints and graphQL endpoints in the service?
Are there any limitations and what are the the general guidelines/recommendations/best practices?
Upvotes: 0
Views: 71
Reputation: 1461
You can have multiple types of interfaces in one service.
Here is a real example: Address Validation API in Google Maps with two endpoints for REST and gRPC.
Different tools (in your case, different API types) solve different problems better. Therefore, when choosing an API type, it is reasonable to be guided by the needs of consumers (which API will be more convenient for a specific use case, are there any special performance requirements, etc.).
For example, you are developing a market information service. It may be quite reasonable to use gRPC API to provide quotes, and GraphQL API to select stocks that meet certain criteria.
Upvotes: 0