- Node.js installed on your machine
- PostgreSQL database server running
git clone https://github.com/pcreem/graphqlTodoServer.git
npm init -y
npm i
npx prisma init
npx prisma migrate save --name init --experimental
npx prisma migrate up --experimental
npx prisma generate
node index.js
modify .env and prisma/.env code run localhost:4000 on your browser
mutation {
signup(
name: "__yourname__"
email: "[email protected]__"
password: "__yourpassword__"
) {
token
user {
id
}
}
}
mutation {
login(
email: "[email protected]__"
password: "__yourpassword__"
) {
token
user {
id
name
posts{
id
title
}
}
}
}
{ "Authorization": "Bearer __Token__" }
mutation {
upsertPost(
postId:"0"
title: "your todo item"
) {
id
title
}
}
mutation {
deletePost(
postId:"__Id__"
) {
id
}
}