-
Hey, I have a simple question but I couldn't find an answer. Is there a way to get user location (country) from a GQL request when it reach the server? If not, what could be an alternative way to get user's country which I could pass in the header? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
It depends on the environment you run Yoga in. Yoga is just a middleware. You will find the request objects and so on in the GraphQL Context and you can check the docs how to get the client's information from there. Maybe you can get the ip from a header then use another API to get the location information. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer. I end up using different approach. My project is build on Vercel and NextJS, so I used it's build in feature for geolocation. |
Beta Was this translation helpful? Give feedback.
It depends on the environment you run Yoga in. Yoga is just a middleware. You will find the request objects and so on in the GraphQL Context and you can check the docs how to get the client's information from there. Maybe you can get the ip from a header then use another API to get the location information.