This example uses Expo (React-Native) — learn more.
This example also uses the x-api-key header for auth. In production environments, you should switch to a supported auth provider using the Authorization header with requests to secure your data.
- Run
npx degit grafbase/grafbase/examples/expo grafbase-with-expoto clone this example - Change directory into the new folder
cd grafbase-with-expo - Run
npm install - Run
cp .env.example .envto copy the example.env.examplefile to.env - Open
.envin your code editor and provide your Grafbase API endpoint and API key. Example should be fine fornpx grafbase dev! - Run
npx grafbase@latest devin your terminal - Populate the backend with some
Emojisentries using a GraphQL mutation:
mutation {
em1: emojiCreate(
input: { char: "🍔", tags: [{ create: { text: "burguer" } }] }
) {
__typename
}
em2: emojiCreate(
input: { char: "❤️", tags: [{ create: { text: "heart" } }] }
) {
__typename
}
em3: emojiCreate(
input: { char: "🥷🏽", tags: [{ create: { text: "ninja" } }] }
) {
__typename
}
em4: emojiCreate(
input: { char: "💣", tags: [{ create: { text: "bomb" } }] }
) {
__typename
}
em5: emojiCreate(
input: { char: "🔥", tags: [{ create: { text: "fire" } }] }
) {
__typename
}
em6: emojiCreate(
input: { char: "📍", tags: [{ create: { text: "location" } }] }
) {
__typename
}
em7: emojiCreate(
input: { char: "💰", tags: [{ create: { text: "money" } }] }
) {
__typename
}
em8: emojiCreate(
input: { char: "📸", tags: [{ create: { text: "camera" } }] }
) {
__typename
}
}-
In another terminal, run
npm startto start the expo process. -
Depending on your platform you may want to run the app on an
AndroidoriOSemulator.
To learn more about Grafbase, take a look at the following resources:
- Grafbase - learn about Grafbase features and API.
To learn more about Expo, take a look at the following resources:
- Expo Documentation - learn about Expo (React-Native).