Inside of the repo, you have a cheat sheet pdf file that contains graphql info, commands, etc https://github.com/Cesar90/nstalk-nestjs-graphql/blob/main/Nestjs%20GraphQL%20Notas.pdf
- Clone the project
- Copy the
.env.template
file and rename it to.env
- In
.env
DB_HOST=db (db = It's service of postgres in docker-compose.yml) DB_PASSWORD=postgres (postgres is an example) - Up the image (Docker desktop)
docker-compose -f docker-compose.yml --env-file .env up --build
- Execute SEED
http://localhost:4000/seed/execute
- Go to the site
localhost:4000/graphql
- Clone the project
- Copy the
.env.template
file and rename it to.env
- Execute
npm install
-
Configure Postgres DB in
.env
-
Up the backend of Nest
npm run start:dev
- Execute SEED
http://localhost:4000/seed/execute
- Go to the site
localhost:4000/graphql
Create account
mutation{
createAccount(input:{
email: "[email protected]",
password: "test",
role: Client
}){
error
ok
}
}
Login
mutation{
login(input:{
email: "[email protected]",
password: "test"
}){
ok
error
token
}
}
Get restaurants
query {
restaurants(input: {
page: 1
}) {
ok
error
totalPages
totalResults
results {
id
name
coverImage
category {
name
}
address
isPromoted
}
}
}
Get one restaurant by id
{
restaurant(input:{
restaurantId: 1
}){
ok
error
restaurant{
menu{
id
name
price
description
options{
name
choices{
name
extra
}
}
}
}
}
}
Get category by slug
query{
category(input:{slug:"tes"}){
ok
totalResults
restaurants{
name
}
}
}