0
votes

I am building a GraphQL server using apollo-server. I need to add few routes to handle OAuth2 redirects/callbacks. How can I add traditional endpoint to the apollo-server?

Note, I am not using apollo-server as a middleware on existing Express or Hapi server. I prefer to use apollo-server standalone and not introduce extra server just for handling one addition route. Also, I am using Nexus to write my GraphQL schema.

Is there any way I can achieve this?

1

1 Answers

2
votes

Note, I am not using apollo-server as a middleware on existing Express or Hapi server. I prefer to use apollo-server standalone and not introduce extra server just for handling one addition route. Also, I am using Nexus to write my GraphQL schema.

What you've said you're not doing is actually the answer here. If it helps, you don't have to worry about "introducing an extra server". apollo-server – the library you're using – is super duper small on its own. This file is the entire thing. It's just a "sugar" wrapper on top of apollo-server-express under the hood.

If you were to attempted to do it anyway and call applyMiddleware with your setup, it'll recommend the same: switch to apollo-server-express.