Setting up your dev environment - 0Calories/untitled-block-game-api GitHub Wiki
In order to run this project locally, you will have
How to setup a local Postgres database
- Create a new database using pgAdmin or the command line
- Navigate to the
prisma
directory in the project - Create a new file and name it
.env
- Add the environment variable for the database URL, replacing the username and password with your credentials, and db with the name of your database:
DATABASE_URL=postgresql://janedoe:mypassword@localhost:5432/mydb
- Run
npx prisma migrate dev --preview-feature
- Generate a new Prisma client by running
npx prisma generate
Running the API locally
At this point, you should have a local database ready to go. You can test out the API by doing the following:
- Create a new
config
directory in the project, and create three new files inside of it:dev.env
,prod.env
, andtest.env
. - In each file, add an environment variable called
JWT_SECRET
. - Assign the secret a value for the
dev
andtest
files, you can use a password generator to make them. Ensure that they are different values for each file. You can get the secrets for theprod
file by asking a lead developer. - Run
yarn dev
. When the console tells you the server is up, go tohttp://localhost:4000/
to view the GraphQL playground