Postgraphile: Wrap a REST API

Created on 8 Dec 2016  ·  7Comments  ·  Source: graphile/postgraphile

Hi!

Using PostgraphQL as a library, is it possible to wrap a REST API as described in this article?

Sometimes the data I need do not come from my database but from an external API. It would be great to only use PostgraphQL for this use case. What do you think about it?

Thanks.

✨ Possible via v4 plugin ❔ question

All 7 comments

Hi @mytototo, expanding PostGraphQL beyond just a postgres schema is on the todo list (see Caleb's vision). In the mean time, there's a couple ways I can think of achieving what you're after:

  1. you could use foreign data wrappers to call out to the REST API from within postgresql (I would NOT recommend this approach unless you're very familiar with the caveats)
  2. you could provide a second REST/GraphQL bridge end point and then use something like react-composite-network-layer to combine the two schemas together as if they were one

Hope this helps.

Thanks for the tips and for the link @benjie. Do you know when this feature will be released-- approximately in 2017?

@mytototo, this is currently a small community project written primarily by Caleb in his spare time (and he's a busy person!); as such we can't give any estimates of when any features will be released. If you were in a position to fund development of the feature (or to add it yourself) then that could certainly change, but short of that it comes down to as-and-when someone has time to build it.

@mytototo : i've done a translation for postgREST to comply with https://github.com/marmelab/admin-on-rest version of REST, though I'd also like to see if we can work together with something like: https://github.com/sarkistlt/graphql-auto-generating-cms

Is this feature released?
@mytototo Please suggest how you achieve this thing with Postgrahql.

Thanks.

The latest on this is probably #448

V4 allows expanding the generated schema with plugins 👍

Was this page helpful?
0 / 5 - 0 ratings