0

I kinda wanted to use the Apollo Client, but sadly it would be too much work to migrate my Django+Bootstrap site to React or Angular.

I'm trying build a feature that requires sending queries to a third party GraphQL server. I was wondering what frontend Javascript library exists that is a good alternative to Apollo client? Would I have to just include what I need from GraphQL JS and build a custom library with webpack?

  • Note that in GraphQL the query is a standard HTML POST request with content being a chunk of text similar JSON and the response is a normal JSON object. JQuery or any other library can do such requests if you don't care to write a few queries asking for the exact data. – Alejandro Jan 14 at 22:08
  • @Alejandro For my case, it'd be simpler to write the queries. I'm gonna need at least the graphql language as part of whatever Javascript package I use. If I need to, I can try to find an http and websockets JS library to handle the connections – brieanna.teanna Jan 14 at 22:12
  • Consider that "GraphQL language" don't exist in Javascript. It's just a string submited to a server sent as part of a POST request. Any web browser has the capability to do this, and tons of libraries enhance it some way or another. – Alejandro Jan 14 at 22:24
  • @Alejandro Oh I see. I think I misunderstood you the first time. Just to check to see if I did understand, what you're saying is I can just send the query as a string in JSON via jQuery Ajax? – brieanna.teanna Jan 14 at 22:50
  • Almost! GraphQL queries are very similar to JSON, but not exactly the same (they're not valid JSON strictly speaking). But save for that, yes, you just send a normal POST request using JQuery or any other standard method you want. The result is standard JSON though, and you can parse it with any tool that handles normal JSON strings and deserialize into Javascript objects for utilization. – Alejandro Jan 14 at 22:54
0

Recently, I expressed a really big interest in GraphQL. I found out a great article that shows all library capabilities for having a GraphQL API. However, it only refers to Node.js applications, but as you ask for a client, you should be just fine. So, I would recommend to you, if you do not want to use the Apollo Client, to use Relay. I have not personally used it, but I have heard great things about it. It is supported and used by Facebook, as well it is great for scalable applications.

I hope that helps, good luck with your project!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.