2. • Web Service Architecture
• Unified Query Language for your data
• Real-time
• Decomposition of your Monolith Architecture
• Easy switch between datastores
Imagine you need…
3. • Web Service Architecture
• Unified Query Language for your data
• Real-time
• Decomposition of your Monolith Architecture
• Easy switch between datastores
6. • Web Service Architecture
• Unified Query Language for your data
• Real-time
• Decomposition of your Monolith Architecture
• Easy switch between datastores
7.
8.
9. REST
• Client-server
• Usage of stateless operations
• HTTP for communication
• URI as string to represent desired resource
• Cacheable and Layered
22. • Web Service Architecture
• Unified Query Language for your data
• Real-time
• Decomposition of your Monolith Architecture
• Easy switch between datastores
23. Subscription
• A long‐lived request that fetches data in response
to source events
• The result is an event stream
• “Pub‐Sub” system may produce an event stream
• Subscriptions, by contrast, are stateful
28. • A community building tools for GraphQL
• Significant work on Subscriptions
• Integration with Hapi, Koa, Meteor, AWS Lambda
• Web client for React, Angular, Vanilla JS
• Mobile client for native iOS and Android
• Authentication support
29. GraphQL Example
const userType = new GraphQLObjectType({
name: 'User',
description: ‘User profile.’,
fields: () => ({
id: {
type: new GraphQLNonNull(GraphQLString),
description: 'The id of the user.',
},
username: {
type: GraphQLString,
description: 'The name of the user.',
},
firstName: {
type: GraphQLString,
description: 'The first name of the user.',
},
lastName: {
type: GraphQLString,
description: 'The last name of the user.',
},
}),
});
const queryType = new GraphQLObjectType({
name: 'Query',
fields: () => ({
users: {
type: userType,
args: {
id: {
type: new GraphQLNonNull(GraphQLString)
}
},
resolve: (root, { id }) => getUser(id),
},
})
});
User Type Query Type
30. GraphQL Schema
# User profile.
type User {
# The id of the user.
id: String!
# The name of the user.
name: String
# The first name of the user.
userName: String
# The last name of the user.
firstName: String
}
User Type Query Type
type Query {
users(id: String!): User
}
33. Apollo Resolver
• Data fetching
• Business logic
• Authorization and Authentication
• Permission rules
• Interface to third-party API
• Caching
34. • Web Service Architecture
• Unified Query Language for your data
• Real-time
• Decomposition of your Monolith Architecture
• Easy switch between datastores
35. • Provide RESTful and Real-Time API
• Service-oriented Architecture
• Datastore Agnostic
• Outstanding Authentication and Permission System
• Client for React, React Native, Angular, Vue
• Scaffolding
36. Feathers Service
export default function() {
const app = this;
const Model = createModel(app);
const options = {
name: 'users',
Model,
};
/* Initialize our service with any options it requires */
app.use('/users', createService(options));
/* Get our initialized service so that we can register hooks and filters */
const service = app.service('users');
service.hooks(hooks);
if (service.filter) {
service.filter(filters);
}
};
38. • Web Service Architecture
• Unified Query Language for your data
• Real-time
• Decomposition of your Monolith Architecture
• Easy switch between datastores
42. • Web Service Architecture
• Unified Query Language for your data
• Real-time
• Decomposition of your Monolith Architecture
• Easy switch between datastores
Service-Oriented GraphQL