Dart flightschool cloudendpoint with dart
Transcript of Dart flightschool cloudendpoint with dart
![Page 1: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/1.jpg)
Google Cloud Endpointswith
Dartlang
![Page 2: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/2.jpg)
誰?
![Page 3: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/3.jpg)
大橋啓介
と申します
![Page 4: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/4.jpg)
@soundTricker318http://goo.gl/ZpUOs
![Page 5: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/5.jpg)
どこの
人?
![Page 7: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/7.jpg)
何やってる?
![Page 8: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/8.jpg)
![Page 9: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/9.jpg)
https://www.flickr.com/photos/centralasian/ (CC)
電車プログラマ
![Page 10: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/10.jpg)
ぼくと
altjs
![Page 11: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/11.jpg)
GWT
GWT Bootstrap※コミッター
CoffeeScript
![Page 12: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/12.jpg)
←Javaで書ける夢を見た
←ナマの JSツライ※Javascript → Javaのポーティング
←漠然とした不安感※今のところココに落ち着いてる
![Page 13: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/13.jpg)
話す事
![Page 14: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/14.jpg)
Google Cloud Endpointswith
Dartlang
![Page 15: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/15.jpg)
Google CloudEndpoints?
![Page 16: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/16.jpg)
https://developers.google.com/appengine/docs/java/endpoints/
What?Google CloudEndpoints?
![Page 17: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/17.jpg)
https://developers.google.com/appengine/docs/java/endpoints/
What?Google CloudEndpoints?
AppEngine 上にバックエンド API を簡単に作成する仕組
![Page 18: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/18.jpg)
https://developers.google.com/appengine/docs/java/endpoints/
What?Google CloudEndpoints?作成したAPI に対するクライアントライブラリを自動生成
![Page 19: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/19.jpg)
使える言語Google CloudEndpoints?
サーバサイド
PythonPythonでCloud Endpointsの事例をあまりみないのでどっか LTとかするとウケそう
![Page 20: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/20.jpg)
使える言語Google CloudEndpoints?
サーバサイド
Java事例もよく見るので始めるのは楽かもJAX-RSに似てるでも結構違う
http://www.flickr.com/photos/andypiper/
![Page 21: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/21.jpg)
使える言語Google CloudEndpoints?
サーバサイド
GoGoogleが直接サポートしているわけではなく、サードパーティツールを使う (後述 )個人的には好き
http://www.flickr.com/photos/andybons/
![Page 22: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/22.jpg)
クライアントGoogle CloudEndpoints?
自動生成ライブラリ
AndroidCloud Endpointsと触ったことが無い ( ー `д ー ´) キリッ
https://www.flickr.com/photos/etnyk/
![Page 23: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/23.jpg)
クライアントGoogle CloudEndpoints?
自動生成ライブラリ
iPhone持ってない ( ー `д ー ´) キリッ
https://www.flickr.com/photos/reticulating/
![Page 24: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/24.jpg)
クライアントGoogle CloudEndpoints?
自動生成ライブラリ
JavaScript自動生成できる、Google API client for JavaScript経由で利用時に作成されたものが使える感じ?
NoImage
![Page 25: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/25.jpg)
クライアントGoogle CloudEndpoints?
自動生成ライブラリ
Dartココに来てやっと ( ー `д ー ´) キリッただ Googleがサポートしているわけではなくサードパーティ製
![Page 26: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/26.jpg)
Google CloudEndpoints
TRY
![Page 27: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/27.jpg)
Google CloudEndpoints
TRY
![Page 28: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/28.jpg)
Google CloudEndpoints
TRY
Third party Third party
![Page 29: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/29.jpg)
サーバサイドGoogle CloudEndpoints
TRY
環境• Appengine Go SDK• Macユーザは brewからでも OK
$ brew install go-app-engine-64
![Page 30: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/30.jpg)
サーバサイドGoogle CloudEndpoints
TRY
ライブラリインストール• go-endpointsを使います
$ go get github.com/crhym3/go-endpoints/endpoints※インストール時にエラーが出ますが気にしないでください。
![Page 31: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/31.jpg)
サーバサイドGoogle CloudEndpoints
TRY
通信用構造体 (struct)を作成• go-endpointsが自動で
JSON←→Struct変換してくれます。
![Page 32: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/32.jpg)
サーバサイドGoogle CloudEndpoints
TRY
通信用構造体 (struct)を作成
![Page 33: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/33.jpg)
サーバサイドGoogle CloudEndpoints
TRY
サービス (実処理 )を作成• go-endpointsが変換した structを引数に渡してくれます。
![Page 34: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/34.jpg)
サーバサイドGoogle CloudEndpoints
TRY
サービス (実処理 )を作成
![Page 35: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/35.jpg)
サーバサイドGoogle CloudEndpoints
TRY
サービスを登録• サービスを go-endpontsに登録
![Page 36: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/36.jpg)
サーバサイドGoogle CloudEndpoints
TRY
サービスを登録
![Page 37: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/37.jpg)
サーバサイドGoogle CloudEndpoints
TRY
app.yamlで設定• go-endpontsが動くようにします。
application: my-app-idversion: v1threadsafe: true
runtime: goapi_version: go1
handlers:- url: /.* script: _go_app
# ここが絶対に必要- url: /_ah/spi/.* script: _go_app
![Page 38: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/38.jpg)
サーバサイドGoogle CloudEndpoints
TRY
起動• appengine go SDK経由
$ goapp serve
![Page 39: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/39.jpg)
サーバサイドGoogle CloudEndpoints
TRY
テスト• http://localhost:8080/_ah/api/explor
er
とかに行けば試せる
![Page 40: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/40.jpg)
サーバサイドGoogle CloudEndpoints
TRY
テスト
![Page 41: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/41.jpg)
サーバサイドGoogle CloudEndpoints
TRY
リリース• goapp deployでリリース
$ goapp deploy
![Page 42: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/42.jpg)
クライアントGoogle CloudEndpoints
TRY
ライブラリの Generatorをインスコ• Generatorがあるのでそれを
Githubから持ってきます。$ git clone
https://github.com/dart-gde/discovery_api_dart_client_generator
$ cd discovery_api_dart_client_generator
$ pub install
![Page 43: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/43.jpg)
クライアントGoogle CloudEndpoints
TRY
ライブラリを作成• generate.dartを呼び出し• dart_{APIの名前 }のディレクトリが出来る$
URL=‘https://hogehoge.appstop.com/_ah/api/discovery/v1/apis/greeting/v1/rest‘
$ curl -s -o greetings.rpc.discovery $URL
$ bin/generate.dart –I greetings.rpc.discovery –o ../ --no-prefix
![Page 44: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/44.jpg)
使い方Google CloudEndpoints
TRY
設定• pubspec.yamlでローカルライブラリを呼び出し
name: GreetingAppdescription: A sample web applicationdependencies: browser: any greeting_v1_api : path : /path/to/dart_greeting_v1_api_client
![Page 45: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/45.jpg)
使い方Google CloudEndpoints
TRY
Import• {API名 }_browser.dart
{API名 }_client.dartを import
import 'package:greeting_v1_api/greeting_v1_api_browser.dart' as greetingLib;import 'package:greeting_v1_api/greeting_v1_api_client.dart' as greetingClient;
![Page 46: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/46.jpg)
使い方Google CloudEndpoints
TRY
呼び出し
greetingLib.Greeting greeting = new greetingLib.Greeting(); greeting.greets.list().then( (greetingClient.GreetingsList value)=> print(value) );
• {API名 }_client側にある {API名 }のインスタンスを作成し、呼び出し
![Page 47: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/47.jpg)
Google CloudEndpoints
TRY
Demo
![Page 48: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/48.jpg)
使い所 ?Google CloudEndpoints
TRY
使いドコロ• コンソールアプリケーション• Chrome Extension/App• Chrome Appなら cordovaとか経由で Android/iPhoneでも使えるかも ?
• 割りと大規模なプロジェクト ?
![Page 49: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/49.jpg)
End
![Page 50: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/50.jpg)
Appendix
元 GWTTER から見たDart
![Page 51: Dart flightschool cloudendpoint with dart](https://reader035.fdocument.pub/reader035/viewer/2022081420/555f2265d8b42abe748b49a3/html5/thumbnails/51.jpg)
お願いアンケートにご協力
を!http://goo.gl/98QcPN