Gerard Sans | Axiom 🇬🇧 PRO
Founder of Axiom Masterclass, professional trainings // Forging skills for the new era of AI. GDE in AI, Cloud & Angular. Building London's tech & art nexus @nextai_london. Speaker | MC | Trainer.
SANS
GERARD
Spoken at 177 events in 39 countries
source: blog
// POST '/graphql'
{
hello
}
// response.data
{
"hello": "Hello world!"
}schema {
query: Query
}
type Query {
hello: String
}Types
Field
Field
Types
Superfast
Safe
Best
Tooling
De-coupled Storage
Collaborative
DEVELOPMENT
PRODUCTION
DEVELOPMENT
PRODUCTION
Analytics
Performance
Logging
Default values
Validation
Caching
Authorisation
Data Formatting
SDL
GQL
Client
GraphQL Server
query
mutation
subscription
Components
Parse
request
Validate
GraphQL Client
Execute
Resolvers
response
SDL
GQL
Client
GraphQL Server
query
mutation
subscription
Components
Parse
request
Validate
GraphQL Client
Execute
Resolvers
response
import { ApolloServer } from '@apollo/server';
import { startStandaloneServer } from '@apollo/server/standalone'
const server = new ApolloServer({
typeDefs,
resolvers
});
const { url } = await startStandaloneServer(server);
console.log(`🚀 Server listening at: ${url}`); // port 4000const typeDefs = `
schema {
query: Query
}
type Query {
hello: String
}
`;const resolvers = {
Query: {
hello: async (parent, args, context, info) {
return "Hello world!";
},
},
};
curl -g \
-X POST \
-H "Content-Type: application/json" \
-d '{ "query": "query { hello }" }' \
https://pkff9q.sse.codesandbox.io/{
"data": {
"hello":"Hello world"
}
}query {
hello
}
Client
Server
GET
POST
PUT
PATCH
DELETE
request
response
400 BAD REQUEST
401 UNAUTHORISED
403 NO PERMISSION
404 RESOURCE NOT FOUND
500 INTERNAL ERROR
...
Client
Server
GET
POST
request
response
200 OK
500 INTERNAL ERROR
curl -g \
-X POST \
-H "Content-Type: application/json" \
https://pkff9q.sse.codesandbox.io/| none (default) | null | null | silent |
| ignore | ✅ | ✅ | silent |
| all | ✅ | ✅ | ✅ |
| data (partial) | errors | UI |
Apollo Server
Apollo Client
ErrorLink
RetryLink
Apollo Links
HttpLink
response
request
By Gerard Sans | Axiom 🇬🇧
In this workshop we will create a Fullstack GraphQL app starting from the Server and building our way up to the client! We will cover everything you need to successfully adopt GraphQL across your stack from client to backend including tooling and best practices. You will learn how to build and design a GraphQL Server starting by defining the GraphQL Schema using types and relations. Moving to the client side, we will create a simple client to demonstrate common usage. As we implement the different features we will introduce GraphQL query syntax including queries, mutations, alias, fragments and directives. At this point we will review how client and server communicate, what tooling is available to track usage and improve performance and how to add authorisation and authentication. Finally we will focus on designing real-time features and sharing best practices to improve performance and leverage scalability.
Founder of Axiom Masterclass, professional trainings // Forging skills for the new era of AI. GDE in AI, Cloud & Angular. Building London's tech & art nexus @nextai_london. Speaker | MC | Trainer.