1

I am new to GraphQL and want to integrate it to my REST API using Apollo server. I am wondering how to apply best practices to setup everything. Here is the scenario:

I have an existing REST API with session cookie authentication via Redis. For now, I run GraphQL on its own server and use axios to send request from Apollo server to my REST API. I read that it is also possible to use Apollo server as a middleware to my existing API but I am not sure if it is the best practice.

With this architecture in place, is it possible to keep reference in Apollo server of the session set in my REST API when login/signup ?

samteb
  • 63
  • 9
  • This is a pretty good question, but we could edit it to make it a little better. Generally, asking multiple questions in one post is [unadvised](https://meta.stackexchange.com/questions/39223/one-post-with-multiple-questions-or-multiple-posts), and your first question is likely to elicit opinion-based answers. Can you edit your post and restate your question just in terms of addressing the scenario you outline in #2? – Daniel Rearden Apr 30 '19 at 08:17
  • Ok, thanks for the reply. I have just updated the question. – samteb Apr 30 '19 at 09:06
  • It also depends on your future plans. If you'll go into micro services design with more rest apis or if there is a chance to separate your rest api into smaller chunks, graphql as a middleware would fit really well. I'd also suggest to check code generation tools for your rest api. Probably there is already something to set up your graphql layer in less then hours – Doğancan Arabacı Apr 30 '19 at 09:12
  • If thinking in micro services, are we agreed that I should implement Apollo server and graphql on its own server, and not use it as a middleware on any existing API ? – samteb Apr 30 '19 at 09:58

0 Answers0