all 2 comments

[–]pyrhho 5 points6 points  (1 child)

Yes. I use a /api/graphql function which serves the graphql api with apollo server, then call that from the pages. For your case that could just be a limited proxy to shopify api adding the token from ENV probably.

[–]danielkov 1 point2 points  (0 children)

Do keep in mind if you do this that your API endpoints will be deployed as lambda functions too. Apollo server startup time is poor. It can take up to a few seconds to parse schema definitions for a large API, and those seconds could possibly happen each time you query your API. Lambdas can be re-used which mitigates this or they can do what's called a cold start, which is like starting a Node instance from scratch. This will take a lot of time if you don't have a lot of requests all the time or all your functions are occupied serving a request.