News for hackers. Stuff that matters.
Re:Is GraphQL the Next Frontier for Web APIs? by throwaway2016a on Friday March 31, 2017 @10:37AM (#14004211)
I'm a major REST advocate (spoken at conferences, written about it in books, etc) and I've been using GraphQL for a few months now and after an initial learning curve I love the flexibility.

But in my opinion, the answer is: write code once, expose both interfaces.

Here's what I mean...

I've been writing my APIs as GraphQL first. Then putting a very light wrapper around GraphQL to expose a REST interface. The REST interface is gold standard (HATEOAS, Json-API, etc) yet it is only a few lines of code. I just have a dictionary of REST -> GraphQL mappings and transform the GraphQL result to Json-API.

Then I also expose the GraphQL interface. So users that want to use GraphQL can.

It's a win-win and it didn't take me any more time to develop than just REST. As an added bonus, the GraphQL code is inherently easier to unit test by nature.

GraphQL has a lot of flaws (for one it has nothing to do with graphs -- nearest I can tell the name is only because it was first used for Facebooks graph database) and things like pagination and error handling have no standard way to do them. But it is very flexible.

Re:Is GraphQL the Next Frontier for Web APIs? by brandur on Friday March 31, 2017 @11:03AM (#14004497)
> I'm a major REST advocate (spoken at conferences, written about it in books, etc) and I've been using GraphQL for a few months now and after an initial learning curve I love the flexibility.

It's good to hear that there are some REST people that are open to potential alternatives :)

> I've been writing my APIs as GraphQL first. Then putting a very light wrapper around GraphQL to expose a REST interface. The REST interface is gold standard (HATEOAS, Json-API, etc) yet it is only a few lines of code. I just have a dictionary of REST -> GraphQL mappings and transform the GraphQL result to Json-API.

I'd certainly agree there. This could change in a year or two, but right now REST-ish APIs are still indisputably dominant. If you want to maximize your developers' experience, it's still too early to _require_ that they use GraphQL because there are going to be a lot of shops out there that are just not set up for it. Of course there is still the option of providing your own libraries and tooling for your users to go through, and if you go with that then the API's implementation is much less important.

Re:Is GraphQL the Next Frontier for Web APIs? by ruslan_talpa on Friday March 31, 2017 @11:16AM (#14004645)
If the answer is: "expose both interfaces" then my implementation is exactly it :) GraphQL & REST API for your database (https://subzero.cloud/) At the core sits PostgREST (https://postgrest.com/)
Re:Is GraphQL the Next Frontier for Web APIs? by _ar7 on Friday March 31, 2017 @01:31PM (#14006037)
I hope you didn't just throw https://github.com/postgraphql/postgraphql and https://postgrest.com/en/v0.4/ behind some closed source code and called it a business.
Re:Is GraphQL the Next Frontier for Web APIs? by ruslan_talpa on Friday March 31, 2017 @01:38PM (#14006113)
Words can hurt you know ... :) https://github.com/begriffs/postgrest/graphs/contributors?fr...

It uses postgrest but not postgraphql, actually not even the graphql-js reference implementation

Re:Is GraphQL the Next Frontier for Web APIs? by PierreRochard on Friday March 31, 2017 @02:27PM (#14006588)
Why? You don't think managing infrastructure composed of open source components is providing a valuable service?
Re:Is GraphQL the Next Frontier for Web APIs? by ruslan_talpa on Friday March 31, 2017 @02:35PM (#14006682)
That of course is valuable but it's not the main thing here. I'd say about 70% of the code powering this entire system is mine.
Re:Is GraphQL the Next Frontier for Web APIs? by alnitak on Friday March 31, 2017 @01:21PM (#14005965)
What is your business model here? Is this (subzero) projected to be an open source product supported by paid services and support, or is it entirely a cloud offering a la graphcool, parse or firebase?
Re:Is GraphQL the Next Frontier for Web APIs? by ruslan_talpa on Friday March 31, 2017 @01:40PM (#14006140)
It's going to be commercial, possible with access to source. You could run it on your infrastructure or have it hosted. Sort of like atlassian
Re:Is GraphQL the Next Frontier for Web APIs? by PierreRochard on Friday March 31, 2017 @02:28PM (#14006596)
No reason it couldn't be a mix of both.
Re:Is GraphQL the Next Frontier for Web APIs? by paulddraper on Friday March 31, 2017 @04:30PM (#14007881)
> for one it has nothing to do with graphs

It can readily convey graph information, e.g. what are the first and last names of the friends of the friends of user 123? But yes, there's nothing really graph specific.

If it bothers you that "Graph Query Language" is too specific, just remember that "Structured Query Language" is too general :)