TroveQL Demo is a simple web app with a GraphQL API on its Express.js server using the TroveQL cache library to showcase TroveQL and its performance metrics desktop application, TroveMetrics, in action.
git clone https://github.com/oslabs-beta/troveql-demo.git
- Go to ElephantSQL, sign in or register for an account, and create a new database instance. Select the free tier as 'Tiny Turtle'. The instance's name and datacenter are up to you.
- Copy your new database instance's URL from the DETAILS tab.
- Check that you have PostgresQL installed. You can run
psql --version
on your command line to check.
- From the root directory of the Demo App, navigate to the /server folder.
- Create a .env file in the server directory and add the following:
PG_URI=//insert your postgresql URI here
Now go to the TroveQL website and download the desktop application for your OS (macOS, Windows, Linux).
- Open your downloaded TroveMetrics desktop application.
- Next, install all the dependencies for the Demo App by running
npm run prestart
on your command line in the root folder. - Finally, run
npm start
from the root directory to start the Demo App on http://localhost:8080/. - Click around and see the TroveQL cache in action from TroveMetrics! (NOTE: If you are seeing proxy errors from Vite in your terminal, try running
killall node
on your command line before runningnpm start
again.)
In the index.ts file in the /server folder, you can customize your TroveQL cache configuration:
const capacity = 5; // size limit of your cache
const graphQLAPI = 'http://localhost:4000/graphql'; // your GraphQL URL endpoint
const useTroveMetrics = true; // (optional) if you would like to use TroveMetrics - default is false
const mutations = {}; // (optional) object where key/value pairs are mutation types/object types mutated (ex. { addMovie: 'movie', editMovie: 'movie', deleteMovie: 'movie' })
const cache = new TroveQLCache(capacity, graphQLAPI, useTroveMetrics, mutations);
To learn more about TroveQL's cache configruation options, visit TroveQL's GitHub page.
Visit the TroveQL website to get more information and watch a video demo of TroveQL and TroveMetrics.
Thank you so much!
Alex Klein - GitHub | LinkedIn
Erika Jung - GitHub | LinkedIn
Sam Henderson - GitHub | LinkedIn
Tricia Yeh - GitHub | LinkedIn