Deploy Now for free!
Charts is a sample app that lets users build online charts using metrics that they provide. For example, you could provide this app with data from an e-commerce site and use it to track site statistics such as the number of page views and revenue. This app demonstrates how to use React hooks with Apollo client to add and read related data. Deploying this app on Slash GraphQL deploys both the back-end database service and a front-end React app in a single click, no credit card required. To learn more about this sample app, see the Charting Sample App on GitHub.
- Create multiple metrics
- Data entry collection
- Plot metrics on line charts with controllable time period
- React (3.4.1)—a JavaScript library for building user interfaces.
- Apollo Client (3.0+)—a comprehensive state management library for JavaScript that enables you to manage both local and remote data with GraphQL.
- Material-UI—a user interface framework for faster and easier web development.
- React Google Charts—a declarative API to make rendering charts fun and easy.
- Slash GraphQL—a fully managed GraphQL backend service
- Copy the entire contents of the
schema.graphql
file located in the root folder of the application. - Open your
Graphql Client
, you can check some GraphQL clients here or open aterminal
and run the following command:curl -X POST localhost:8080/admin/schema --data-binary <@SCHEMA.GRAPHQL>
, which contains the code copied in step 1. - To run the application locally go to the
src
folder and find theapollo-client.js
file and replaceuri: process.env.REACT_APP_GRAPHQL_ENDPOINT || "<API-ENDPOINT>"
byuri: process.env.REACT_APP_GRAPHQL_ENDPOINT || "http://localhost:8080/graphql"
. - In the root folder of the application, open a terminal and run the following commands:
npm install
followed bynpm start
.
- Create an authentication service account on: Auth0.
- After creating your Auth0 account, follow the instructions provided here to set up Auth0 authentication.
- Open the
schema.graphql
file located in the root folder and apply therules
as described in step 2. - Then open your
Graphql Client
, you can check some GraphQL clients here or open aterminal
and run the following command:curl -X POST localhost:8080/admin/schema --data-binary <@SCHEMA.GRAPHQL>
. - To run the application locally go to the
src
folder and find theapollo-client.js
file and replaceuri: process.env.REACT_APP_GRAPHQL_ENDPOINT || "<API-ENDPOINT>"
byuri: process.env.REACT_APP_GRAPHQL_ENDPOINT || "http://localhost:8080/graphql"
. - In the root folder of the application, open a terminal and run the following commands:
npm install
followed bynpm start
.