Follow this guide to create your databases
Once you have complete the above guide, continue to the steps below.
.env.example
and name it .env
(NOTE: Make sure to copy the file, don't remove the original).env
file's DATABASE_URL
variable, keeping ?schema=prisma
on the end. E.g. DATABASE_URL="postgres://uy:ay@ka.db.elephantsql.com/ufy?schema=prisma"
SHADOW_DATABASE_URL
variable, keeping ?schema=shadow
on the end. E.g. SHADOW_DATABASE_URL="postgres://jk:la@ka.db.elephantsql.com/irk?schema=shadow"
npm ci
to install dependenciesnpx prisma migrate reset
to build the database tables and insert some seed data (as defined in ./prisma/seed.js)npm run dev
to run the app[todo]:
The API Spec is hosted by the server itself (i.e. this project), and the view/page is generated automatically by the SwaggerUI libraryi.
To view it locally, you can just go to: http://localhost:4000/api-docs.
Whenever you make any change to the API (e.g. adding a new route, changing the payload for an existing route, adding a new error), you must update the API Spec accordingly. To do this, you just need to update the openapi.yaml
file -- guidance on the basic structure of the openapi.yaml
file can be found here.
openapi.yaml
file, you will need to stop and restart your server.Please review the ./prisma/seed.js file to see the data that is seeded into the database when you run npx prisma migrate reset
.
The users that are seeded can be used to test the API endpoints and to log into the client app.
[todo]:
TODO