Upgrade to Pro — share decks privately, control downloads, hide ads and more …

API Server made of Golang

shanonim
April 23, 2017

API Server made of Golang

shanonim

April 23, 2017
Tweet

More Decks by shanonim

Other Decks in Technology

Transcript

  1. API Server made of Golang
    @shanonim

    View Slide

  2. About me
    - @shanonim
    - Android (Kotlin), Java, C++
    - Go Beginner

    View Slide

  3. 個人アプリのAPIを作りたい
    - 東京の銭湯マップアプリ
    - APIほしい
    - Java?
    - Rails?
    - “How about Golang?”

    View Slide

  4. - Google Map
    - 銭湯の位置にPinを置く
    - Pin情報をAPIで返す
    - 名前 (string)
    - 場所 (string)
    - 営業時間 (string)
    - サウナ有り無し (bool)

    View Slide

  5. How to build API Server with Golang
    - httprouter
    - https://github.com/julienschmidt/httprouter
    - HTTP request router
    - `go get github.com/julienschmidt/httprouter`

    View Slide

  6. z

    View Slide

  7. View Slide

  8. View Slide

  9. 詰んだポイント (1/2)
    - IntelliJでGolang
    - 外部ライブラリをgo getしても補完候補に出てくれない問題
    - (Qiita) go getしたライブラリをIntelliJ IDEAの補完候補に追加するには
    - http://qiita.com/grapswiz/items/e1da3181e9a3c7681ba2
    - .bashrcにGOPATH書いたら解決した
    - :innocent:

    View Slide

  10. 詰んだポイント (2/2)
    - Package分けたらRunできなくなった
    - GOPATH/srcにProjectフォルダを移動したら治った
    - (stackoverflow) GO in IntelliJ IDEA. Multiple File and Error Undefined: Data
    - http://stackoverflow.com/questions/32508254/go-in-intellij-idea-multiple-file-and-err
    or-undefined-data
    - Run kind -> Package

    View Slide

  11. ToDo
    - API Server on the GAE
    - Not yet
    - Get JSON with Android App
    - Not yet

    View Slide

  12. 合宿中に読んだ資料
    - 「メルカリ アッテ」を支える Google App Engine と Golang
    - https://speakerdeck.com/ttsuruoka/merukari-atute-wozhi-eru-google-app-engine-to-golang
    - Go で API サーバーを開発してきて 1年が過ぎました
    - http://aial.shiroyagi.co.jp/2016/07/golang-api-server-developing/
    - GoでJSON APIを書く
    - http://sgykfjsm.github.io/blog/2016/03/13/golang-json-api-tutorial/

    View Slide

  13. 感想
    - ずっとやってみたいと思っていたサーバーサイド言語ができてよかった
    - Golangたーのしー!
    - Libraryつよい
    - 勉強会ドリブン・合宿ドリブン、良い
    - アルコールドリブン、良い
    - 深夜4時半のRun成功

    View Slide