Hacker News new | ask | show | jobs
by baron816 3253 days ago
I tried to build a GraphQL server, but found it impractical since I didn't want to use Relay or Apollo on the front end. Formatting the query strings just made a mess and was a lot of trouble considering the simple resources I needed. Dealing with authentication and authorization looked like it was going to be a headache as well. I ended up going back to REST.

Should I give it another look? Was I too quick to dismiss it?

4 comments

I've just started building a server/client seed that I can use in the future for my personal projects.

The concerns you have with the front-end are founded. However, you can send a request to a GraphQL endpoint in a very REST-like manner. If you can build a wrapper to create the query as explained in the Stack Overflow post, you can essentially negate the need for Relay/Apollo. (At least until you need any of the helpful tools they provide.)

https://stackoverflow.com/questions/42520663/how-send-graphq...

One thing that may be helpful is a smaller client like Apollo-link (https://github.com/apollographql/apollo-link) that can grow to fit your client needs.

The basic http link includes middleware for passing auth to the server.

I hope that helps!

Not sure if you're not going to use it with Apollo/Relay. These clients help you format queries in JS with Babel transforms. These transforms also are what help couple your front end to your back end by validating queries at front end compile time webpack bundling), which is a huge element of the charm imo.
+ they can help you implement caching strategies / offline modes
Try PostgREST