Mithun Kamath
- Github | @callmekatootie
- Twitter | @callmekatootie
- Discord | @callmekatootie#5679
A GraphQL api for Medusajs. It currently wraps the existing Store REST api and support for Admin REST api will be added based on demand.
- Medusa Server. You may need to install additional plugins, depending on the api(s) / queries and mutations that you perform. Read Medusajs's documentation for know more.
- Nodejs (16+)
You can set the following environment variables during deployment. For local deployment, create a .env file and set your variables
MEDUSA_SERVER // Your Medusa server endpoint address
NODE_ENV // You can set to `development` to get verbose errors
PORT // Port at which you would like to run the graphql server. Defaults to 4000- Clone this repository
$ git clone https://github.com/suhailkakar/react-native-medusajs- Install dependencies
$ cd react-native-medusajs
$ npm install- Set environment variables
- Start the app
$ npm start
> [email protected] start
> node index.js
🧘 Yoga - Running GraphQL Server at http://0.0.0.0:4000/graphqlThat's it. You can access the graphql api at http://0.0.0.0:4000/graphql
For store related api(s), you will need follow the Authentication instructions located in the Store REST api documentation. Once you obtain the {sid} bit (the string after connect.sid=), you will invoke the graphql api with the following header:
{
"x-api-key": "{sid}"
}Using an example from the Store REST api documentation, your final header would be:
{
"x-api-key": "s%3A2Bu8BkaP9JUfHu9rG59G16Ma0QZf6Gj1.WT549XqX37PN8n0OecqnMCq798eLjZC5IT7yiDCBHPM"
}metadatais an object in the source api. Graphql converts it to a string (JSON.stringify()) when it retrieves the value. When you are passing a value for this field in a mutation, pass theJSON.strigify()'ed version of it- enum fields need to be in UPPERCASE.
Refer to TODO.md for complete list of implemented endpoints

