-
GraphQL: a query language that allows us to build even complex queries quickly and concisely, helping to make sure our queries fetch data -- and only the data we need -- quickly.
-
Apollo Sandbox: an Apollo Studio Explorer tool and is a great way to to visually explore how GraphQL can be used to request and fetch data while in development. (Not a production tool). We create queries here to fetch data. Query looks like:
query classes{
classes {
name
}
}
-
Apollo server: a type of GraphQL server that uses a schema to describe the shape of your available data.
-
typeDefs:
(1) defines fields on a database record (like the schema)
(2) queries: functions that retrieve data - GET
(3) mutations: functions to modify data - POST/DELETE/UPDATE
-
resolvers:
(1) function definitions where we make db calls
Queries in Apollo Sandbox
query GetAllUsers {
getAllUsers {
email
}
}
Mutations
mutation {
createUser (name: "Sam", email: "mike@email.com", age: 30) {
name
email
age
}
}
- Video: GraphQL Tutorial For Beginners - Apollo Server Express Tutorial, https://youtu.be/xCzm1bbOpfw
- Complete repo - https://github.com/loriculberson/graphql-users-demo