dulnan / nuxt-graphql-middleware

GraphQL in the backend, fetch in the frontend. With TypeScript support.
https://nuxt-graphql-middleware.dulnan.net
MIT License
57 stars 11 forks source link

[Question] Support in server side #15

Closed Applelo closed 9 months ago

Applelo commented 1 year ago

Hi, I need to do some request in server side, via custom api route. Is it possible currently ? I don't want to do a request to/api/graphql_middleware/query/myRequest in server side and call directly the graphql API.

Note: Thanks for your module, it makes my current project really clean :)

dulnan commented 9 months ago

Hey sorry for the late reply. I hope you were able to get it working in the meantime. If not (and for future reference for others), the composable can be used in server contexts by importing it from here:

import { useGraphqlQuery } from '#graphql-composable'

It's important to import this one, because it behaves slightly different than the auto-imported composable available in Vue context.