REST
- Performance
- Simplicity
- Scalability
- Discoverability
x / 7
| Name | Organisation | |
|---|---|---|
| Andreas Møller | andreas@cylindo.com | Cylindo |
| Richard Nixon | dick@whitehouse.com | US Presidents |
| Peter Parker | spidey@avengers.com | The Avengers |
| Rainbow Dash | r.dash@ponys.com | My Little Pony |
| Leonardo | leo@tmnt.com | TMNT |
GET /users
[{
id:1,
name:"Andreas Møller",
email:"andreas@cylindo.com",
title: "Mr",
twitter:"https://twitter.com/cullophid",
linkedIn: "https://www.linkedin.com/in/andreas-m%C3%B8ller-bbb1a14",
addressLine1:"Rødovrevej",
addressLine2:"",
city:"Rødovre",
country:"Denmark",
postcode:"2610",
houseNumber:"220A",
appartment: "1. th",
avatar: "https://example.com/users/1",
roles: [1, 3, 5, 6],
createdAt: "2018-05-10T10:23:12.123Z",
updatedAt: "2018-05-10T10:23:12.123Z",
organisation:1
},
...
]
GET /users
[{
id:1,
name:"Andreas Møller",
email:"andreas@cylindo.com",
avatar: "https://example.com/users/1",
organisation:1,
...
},
{
id:2,
name:"Richard Nixon",
email:"dick@whitehouse.com",
avatar: "https://example.com/users/2",
organisation:2,
...
},
...
]
GET /organisations/1
GET /organisations/2
...
GET /organisations/3
REST
Performance- Simplicity
- Scalability
- Discoverability
GET /users-with-orgs
[{
id:1,
name:"Andreas Møller",
email:"andreas@cylindo.com",
avatar: "https://example.com/users/1",
organisation:{
id: 1,
name: "Cylindo"
}
},
{
id:2,
name:"Richard Nixon",
email:"dick@whitehouse.com",
avatar: "https://example.com/users/2",
organisation: {
id: 2,
name: "US Presidents"
}
},
...
]
GET /users-with-*
NOT REST
REST
Performance- Simplicity
- Scalability
- Discoverability
SimplicityScalability
Discoverability
GraphQL
{
users {
id
name
email
organisation {
id
name
}
}{
"data": {
"users": {
"id":1,
"name":"Andreas Møller",
"email":"andreas@cylindo.com",
"organisation": {
"id":1,
"name":"Cylindo"
}
}
}
}POST /graphql
GraphQL
- Performance
- Simplicity
- Scalability
- Discoverability?
type Query {
users:[User!]!
organisations: [Organisation!]!
}
type User {
id:ID!
name:String!
email:String!
title: String
twitter:String
linkedIn: String
addressLine1:String
addressLine2:String
city:String
country:String
postcode:String
houseNumber:String
appartment: String
avatar: String
roles: [Role]
createdAt: DateTime
updatedAt: DateTime
organisation:Organisation!
}
{
__schema {
types {
name
}
}
}Introspection
{
"data":{
"__schema": {
"types": [
{
"name": "Query"
},
{
"name": "User"
},
{
"name": "Organsation"
},
{
"name":"Role"
}
]
}
}
}deck
By Andreas Møller
deck
- 142