Configuration | Technologies | Queries | Mutations |
- cd graphql-api
- npm install
- crie seu arquivo .env
- create database products-graphql
- npx knex migrate:latest
- npm start
- Apollo-server
- Node
- Nodemon
- Knex
- Mysql
- Graphql
- Dotenv
Query 'products':
products {
id name quantity price
}
Response:
{
data: {
products: [
{
id: 1,
name: "Example",
quantity: 1,
price: 1
}
]
}
}
Query 'product(id: Int)':
product(id: 1) {
id name quantity price
}
Response:
{
data: {
product: {
id: 1,
name: "Example",
quantity: 1,
price: 1
}
}
}
Mutation 'newProduct(data: ProductInput)':
newProduct(data: ProductInput) {
id name quantity price
}
Response:
{
data: {
newProduct: {
id: 1,
name: "Example",
quantity: 1,
price: 1
}
}
}
Mutation 'updateProduct(id: Int, data: ProductInput)':
updateProduct(id: Int, data: ProductInput) {
id name quantity price
}
Response:
{
data: {
updateProduct: {
id: 1,
name: "New name",
price: 1,
quantity: 1
}
}
}
Mutation 'deleteProduct(id: Int)':
deleteProduct(id: Int) {
id name quantity price
}
Response:
{
data: {
deleteProduct: {
id: 1,
name: "Example",
quantity: 1,
price: 1
}
}
}
Que a força esteja com você 💪