Build and Deploy a GraphQL API to the Edge with Fauna โ€” Part 3

Jamie BartonJamie Barton
1 min read

Let's begin by installing the Fauna JavaScript driver inside our project so that we can use it inside our first resolver:

npm install fauna graphql

Now create the file grafbase/resolvers/create.ts.

We'll complete this inside the next step but for now, we can import Fauna and initialize a new client:

import { Client, fql, FaunaError } from "fauna";

const client = new Client();
๐Ÿ’ก
Fauna automatically detects the environment variable FAUNA_SECRET. If you name it something else, you'll need to pass it to Client().

That's it!

Continue to Part 4 ๐Ÿ‘‰

0
Subscribe to my newsletter

Read articles from Jamie Barton directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Jamie Barton
Jamie Barton