StripeCon New Zealand 2017 - Aaron Carlino - Building a modern, API-driven application in SS4
-
Upload
silverstripe -
Category
Technology
-
view
42 -
download
0
Transcript of StripeCon New Zealand 2017 - Aaron Carlino - Building a modern, API-driven application in SS4
Head less
SilverStripeBuilding a modern, API-driven application in SS4
Aaron Carlino
@_UncleCheese_
24 November 2017
• This? Seriously?
• Most popular: unclecheese/send-all-errors-to-ingo’s-inbox
• It was a café.
• Also a café. They were all cafés.
• It's now a café.
• "Beast" = wind.
• No feature requests please.
About Me
Strudel.jsAurelia
Chaplin.js
Ember.js
Vue.jsInferno
Cappuccino
Maputo
Mojito
Meteor
RxJS
Fisk
Backbone.js
Tektite
ReactWakanda
Strudel.jsAurelia
Chaplin.js
Ember.js
Vue.jsInferno
Cappuccino
Maputo
Mojito
Meteor
RxJS
Fisk
Backbone.js
Tektite
ReactWakanda
GET /api/v1/blogs?include=title,content
GET /api/v1/blogs?include=title,comments.count
GET /api/v1/blogs?include=title,comments.latest???
Params to the rescue
GET /api/v1/blogs_with_title_and_teaser
GET /api/v1/blog_summary_with_comment_count
GET /api/v1/blogs_with_latest_comment
Custom endpoints
{
blogs (memberID: 5) {
title
content
author {
firstName
surname
}
comments {
pageInfo {
totalCount
}
}
tags {
title
}
}
}
{
blogs (memberID: 5) {
title
content
author {
firstName
surname
}
comments {
pageInfo {
totalCount
}
}
tags {
title
}
}
}
ListOf: BlogType
AuthorType
String
CommentType
Int
TagType
Our Backend
$ composer create-project silverstripe/recipe-core graphql-server
$ cd graphql-server/
$ composer require silverstripe/graphql
$ composer require silverstripe/graphql-devtools
$ composer require silverstripe/versioned
$ composer require silverstripe/sqlite3:dev-master
$ vendor/bin/sake dev/build flush=1
Our Frontend
$ create-react-app dogapp
$ cd dogapp/
$ yarn add graphql graphql-tag material-ui@next
material-ui-icons@next prop-types
apollo-client apollo-cache-inmemory
apollo-link-http react-apollo