Stop wRESTling with your API. Use GraphQL
GraphQL
Motivation
Praxis
Theorie
Ausblick
Aufgabe (Task)
Notizen
Deadline
Kategorie (Category)
Title | Category | Place | Date | State |
---|---|---|---|---|
Buying apples | shopping | Walmart | 2018-03-10 | Done |
Buying tv | shopping | Pending | ||
Program graphql | university | 2018-03-08 | Done |
Frontend
Backend
?
GET myapi.com/v1/todo/1
{
"title": "Buying apples",
"note": "Buying apples at Walmart",
"category": "shopping",
"date": 1524123265,
"place": "Walmart",
"sameCategory": [
2
],
"sameDate": [
3
]
}
GET myapi.com/task_with_images/2
GET myapi.com/task_with_images_and_date/2
GET myapi.com/task_with_images_and_date_and_description/2
GET myapi.com/task_with_images_and_description_and_date_and_owner/2
GET myapi.com/task?include=image,description,date,owner,created_at
gleiche
Kategorie
gleiche
Kategorie
gleiches
Datum
gleiches
Datum
hat
hat
hat
hat
Kategorie
Kategorie
Aufgabe
Aufgabe
Aufgabe
Aufgabe
Aufgabe
Vergleichbar mit den HTTP-Methods von REST
type Query {
category (title: String): [task]
tasks (state: Boolean): [task]
task (id: ID): task
date (from: Date, to: Date): [task]
}
type Task {
_id: ID!
title: String
state: Boolean
notes: String
date: Date
place: String
category: String
notes: String
sameDate: [Task]
samePlace: [Task]
sameCategory: [Task]
}
Text