LoginSignup
0
1

More than 5 years have passed since last update.

golangのお勉強13+goa

Posted at

Example

実は公式のサンプル集みたいなのを見ると結構いいかも。。
でも、最終日付を見るとあまり更新されてないのは不安かも。。

公式のレポジトリ一覧。

goa
https://github.com/goadesign

gormaをつかったバージョンのgoa-celler
gormaをグローバル変数にしてるのね。
サイトの説明ではコンテキストかコントローラー経由って書いてあったけどグローバルでもいいってことかしら。

goadesign/gorma-cellar: Same design as goa-cellar, but with the added gorma integration
https://github.com/goadesign/gorma-cellar

小さな事例集、より完全な例はgoa-cellerって書いてあるけど、補完する例を含むなら見る価値あるかもな。

goadesign/examples: Examples for goa showing specific capabilities
https://github.com/goadesign/examples

ワインセラー。事例を紹介するための簡易サービスの実装という感じかな。

goadesign/goa-cellar: goa winecellar example service
https://github.com/goadesign/goa-cellar

認証(JWT)

google openIDの認証のJWTと通常のJWTが異なるので、
goagen jsしたコードは親和性が低そう。
どうしようかなあ。。

自作パッケージでcodegen jsの事例

おー、なるほど。すごい。
最終的にはswagger-codegenを紹介していた。
swaggerベースの場合、認証にまで対応できるのかな。。
どれがいいのか検証なのかなあ。。うーん。

goaのdesignからもっといいJSコードを生成する — そこはかとなく書くよん。
http://tdoc.info/blog/2017/06/19/goa_gen_js.html

jsについては一旦シンプルにしておく

認証などは面倒なので後回し。
多分publicに出力してやるパターンとかpath調整は可能だろう。

bash
goagen js
design.go
var _ = Resource("js", func() {
    Origin("*", func() {
        Methods("GET", "OPTIONS")
    })
    Files("/js/*filepath", "js")
})
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1