A great boilerplate to start your new graphql project.
yarn install
yarn local:db:up
Wait until database is ready.
yarn local:migrate:up
yarn local
yarn install
- Install yarn dependenciesyarn local:db:up
- Create a new database (with docker-compose)yarn local:migrate:up
- Send migrations to database (Create schema in the database)yarn local
- Run local server // @TODO ~ put this inside docker compose with volume and nodemonyarn uninstall
- Remove docker containers (then you can safely remove this folder)
You can see a list of test queries to execute on graphql playground.
See Example Queries
- Typescript
- Nexus (nexus-future)
- Docker compose - Right now it's only creating a new database // @TODO ~ put this server inside a container and create a volume
- Node
- Yarn (or npm)
- Docker compose
- A developer (did you get it?)
NODE_ENV=
localMASTERKEY
=localmasterkeyPORT
=4001DB_URL
=mysql://prisma:prisma@localhost:3310/workouts
@TODO ~ If you define a masterkey, then you need to send it in the header of all requests to this graphql server. More details below on Masterkey Authentication.
Somethings are not automatic. Here is what you need to do when you do what you do.
When you... | Do this! |
---|---|
Change file: prisma/schema.prisma |
Run yarn local:migrate:save && yarn local:migrate:up |
Change file: local.yml |
Run yarn local:db:up |
yarn local:migrate:save
- Update the folder prisma/migrations with the new schema definition on schema.prisma (prisma2 migrate save --experimental
)yarn local:migrate:up
- Sync database with the newly created migrations (prisma2 migrate up --experimental
)yarn local:db:up
- Roda o banco de dados local (via docker-compose)
@TODO ~ Not implemented yet.
If you define a MASTERKEY env variable, then this string must be send to every API call.
Header:
X-Masterkey: XXXXXXX
The masterkey config is located at
config/*.env
.
This project comes with a default schema with "tags". This allows you to immediately test your API and maybe you even like the initial schema and start building your software with tags...
A Todo
may have as many tags as the client wants.
When you query todos(tags:["tag1","tag2"]) { ... }
you need to send an array with tags. The todos must be related to all the tags you send (but it may have more).
If you pass an empty tags array, then all todos are returned.
- Steps to deploy in production
- Add seed todos