aaronpowell / dab-react-trivia-demo

A demo application using React and SWA Database Connections

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Azure Static Web App Database Connections sample

This is a sample application on how to use the Azure Static Web App Database Connections feature to expose Cosmos DB with GraphQL.

The application is written in React (with TypeScript), uses GraphQL Code Generator to generate TypeScript types from the GraphQL schema, and Apollo Client to query the GraphQL API.

You can learn more about it in the companion blog post.

Running the application

This repo contains a VSCode devcontainer configuration, so you can open the repo in VSCode and have it provision a local Cosmos DB emulator instance for you. You can use the Azure Database VS Code extension to connect to the emulator and create a database and collection. There's also a sample dataset that can be uploaded at data/trivia.json.

Once the database is provisioned you can run npm install followed by npm start then navigate to http://localhost:4280.

About

A demo application using React and SWA Database Connections

License:MIT License


Languages

Language:TypeScript 83.6%Language:CSS 9.6%Language:Shell 2.9%Language:Dockerfile 1.9%Language:HTML 1.9%