Skip to content

Example of client-side rendered React app fetching products from a Fauna GraphQL API endpoint. This example is using TypeScript and Apollo. Created with create-react-app.

Notifications You must be signed in to change notification settings

alexanderalmstrom/fauna-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fauna Demo

Getting started

Clone this repo and cd into directory.

git clone [email protected]:alexanderalmstrom/fauna-demo.git
cd fauna-demo

Install npm dependencies.

yarn install

Create a .env.local file in the root and replace XXX with your Fauna secret key. Create your account and key at https://fauna.com/

REACT_APP_FAUNA_SECRET=XXX

Import schema.graphql in Fauna dashboard.

Create some products in the GraphQL playground tab with mutations.

mutation CreateProduct {
  createProduct(
    data: {
      name: "Some product name"
      description: "Some product description"
      price: 100.00
    }
  ) {
    name
    description
    price
  }
}

List all products with

query ListProducts {
  allProducts {
    data {
      name
      description
      price
    }
  }
}

Run development server

yarn start

About

Example of client-side rendered React app fetching products from a Fauna GraphQL API endpoint. This example is using TypeScript and Apollo. Created with create-react-app.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published