I have a Golang program working with Twirp and I want to create GraphQl server, but as far as I know, twirp build on top of the Rest API
Asked
Active
Viewed 357 times
1
-
graphql is json over http. rpc is a different paradigm. But you can always build an api wrapper over an rpc framework. – Daksh M. Nov 05 '18 at 13:27
-
@DakshMiglani should I create a second graphql API to work with twirp API? Is it hard to do ? – GGG Nov 05 '18 at 13:40
-
yeah. Make a graphql api and use twirp in the resolvers to fetch the data and all. – Daksh M. Nov 05 '18 at 14:33
-
read this article: https://graphql.org/blog/rest-api-graphql-wrapper/ – Daksh M. Nov 05 '18 at 14:33
-
@DakshMiglani Thanks – GGG Nov 05 '18 at 18:11
1 Answers
1
It is definitely possible.
You Just have to make a wrapper over the Twirp based RPC API.
This is a similar case to wrapping a GraphQL API over a Rest API.
You should also read this article, where the wrapping of a graphql api over a rest one is shown.

Daksh M.
- 4,589
- 4
- 30
- 46