w8mngr utilizing Netlify's functions and a React SPA
- Faturdays
- Reminders
- Routines
- Personal Trainers
To setup your database, you must have docker-compose
installed. Once it's installed:
$ docker-compose up
This will start Postgres!
This repository was made with yarn
3. I highly recommend you use it! To install the packages and build things you need:
$ yarn
$ yarn gql:generate
Now, you're ready to test and develop.
If you have configured Postgres properly, you should be able to run the following commands:
$ yarn db:reset
$ yarn develop
Once the server is running, you can login as a seed admin with the following credentials:
username: [email protected]
password: test
Our development environment uses PM2 to manage its various build processes and watch threads, as well as to aggregate logging.
$ yarn pm2 logs all # See all aggregate logs
$ yarn pm2 logs web # See only the `web` API logs
$ yarn pm2 stop all # Stop all services
$ yarn pm2 dash # Show the PM2 dashboard
Our test suite needs a live PG database, so make sure yarn db:reset
works before you try to test. Each test suite (e.g., each file) will create its own schema, run our migrations, and run a test against that discrete database.
$ yarn test # Test all of our suites
$ yarn test <file1> <fileN> # Test one or more files
To signal to the test runner that you require access to the database, make sure you do this at the top of your database tests:
import { getTestGlobalContext, usesDatabase } from "../../config/test";
usesDatabase();
This function will ensure that your database tests are fully isolated from other tests (as well as your development environment data) and are properly cleaned up after the test run.