Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
家計簿管理システム Midas について / balance system Midas
Search
firedial
September 25, 2019
Programming
1
230
家計簿管理システム Midas について / balance system Midas
趣味で作った家計簿管理システムについて。
API 側の Golang をメインに紹介した。
firedial
September 25, 2019
Tweet
Share
More Decks by firedial
See All by firedial
SSL のハンドシェイクについて
firedial
0
320
Other Decks in Programming
See All in Programming
Spatial Rendering for Apple Vision Pro
warrenm
0
160
AWSのLambdaで PHPを動かす選択肢
rinchoku
2
310
17年周年のWebアプリケーションにTanStack Queryを導入する / Implementing TanStack Query in a 17th Anniversary Web Application
saitolume
0
250
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
350
AppRouterを用いた大規模サービス開発におけるディレクトリ構成の変遷と問題点
eiganken
1
180
採用事例の少ないSvelteを選んだ理由と それを正解にするためにやっていること
oekazuma
2
1.1k
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
260
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
210
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
150
nekko cloudにおけるProxmox VE利用事例
irumaru
3
460
CloudflareStack でRAGに入門
asahiiwm
0
110
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
110
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
The Language of Interfaces
destraynor
155
24k
Facilitating Awesome Meetings
lara
50
6.1k
Building Applications with DynamoDB
mza
91
6.1k
Designing for Performance
lara
604
68k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
The World Runs on Bad Software
bkeepers
PRO
66
11k
Designing for humans not robots
tammielis
250
25k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Building Your Own Lightsaber
phodgson
103
6.1k
Transcript
ՈܭཧγεςϜ Midas ʹ͍ͭͯ firedial DesignOne Go #5 September 25, 2019 firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 1 / 28
ࣗݾհ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 2 / 28
ࣗݾհ ໊લ: firedial ੜޙ: 9829 ग़: ࣎լݝ झຯ: ϏϦϠʔυɺֶɺࢄࡦɺ٤ళۦಈ։ൃ ࠷ۙݟ͚ͭͨެࣜ: n ∑ k=0 (−1)k n Ck kn+m = n+m Pn tm (n) tm (n) := lim x→0 dm dxm ( ex − 1 x ) n firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 3 / 28
ࣗݾհ ࠓ·Ͱ৮Ε͖ͯͨओͳݴޠ (ख़͍ͯ͠Δͱݴ͍ͬͯͳ͍) C (3 ) PHP (2 ) C++ (1 ) VBA (1 ) Haskell () Elm () Golang () Ruby on Rails (3 ϲ݄) firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 4 / 28
࠷ۙͨ͠ۦಈ։ൃ ࠷ۙͨ͠ۦಈ։ൃ... firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 5 / 28
ࢁۦಈ։ൃ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 6 / 28
Πϯελө͑ ͢Έ·ͤΜɺຊࢁͰ։ൃ͍ͯ͠·ͤΜɻ શʹΠϯελө͑ૂ͍ͬͯ·ͨ͠ɻ Πϯελ͍ͬͯ·ͤΜɻ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 7 / 28
Midas ͷհ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 8 / 28
Midas ͷ֓ཁ Midas (ϛμε) ͱՈܭཧγεςϜͷ͜ͱͰ͋Δɻ ཧ͢ΔใҎԼͷͷͰ͋Δ (balance ςʔϒϧ)ɻ ֹۚ (-500 ԁ) ߲ (͏ͲΜ) छผ (ன͝Μ) ༧ࢉ (৯අ) ॴ (ࡒ) (2019/9/14) छผɺ༧ࢉɺॴ ID Խ͞Ε͍ͯΔ (attribute ςʔϒϧ)ɻ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 9 / 28
Midas ͷઆ໌ ϑϩϯτ: Elm API: Golang (Gin ϑϨʔϜϫʔΫ) DB: MySQL ϦόʔεϓϩΩγ: Nginx firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 10 / 28
Elm ͱͳʹ͔ Elm ͱ AltJs ͷҰछͰɺؔܕݴޠͰ͋Δɻ Elm ༗໊ͳͷͰɺΈͳ͞Μ͝ଘͰ͢ΑͶʁʁʁ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 11 / 28
Elm ͱͳʹ͔ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 12 / 28
Elm ͱͳʹ͔ ͦ͏ɺԿΛӅͦ͏ɺ ࠓߋֶͳ͍͍ͯ͘ݴޠ1Ґ Ͱ͢ʂʂʂʂ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 13 / 28
ؓٳ ؓٳ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 14 / 28
ߏਤ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 15 / 28
Misuzu ʹ͍ͭͯ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 16 / 28
Misuzu ͷઆ໌ Misuzu ͷ API ͰͰ͖Δ͜ͱ औಘ ▶ balance ςʔϒϧ ▶ attribute ςʔϒϧ ૠೖ ▶ balance ςʔϒϧ ▶ ༧ࢉͱॴͷҠಈ (balance ςʔϒϧʹ 2 Ϩίʔυૠೖ) ूܭ ▶ छผ (·ͨ༧ࢉॴ) ͷ ID ผͷ߹ܭ ▶ ผͷ߹ܭ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 17 / 28
ґଘؔਤ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 18 / 28
firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 19 / 28
Midas ʹ͕͋ͬͨɻͦ͏ɺೝূΛ͍ͯ͠ͳ͍ͷͰ͋Δɻ ༑ਓʹ wi-fi Λିͨ࣌͠ɺ http://192.168.1.6:8080/api/v1/sum/ Λୟ͔ΕΔͱશࡒ࢈͕औಘͰ͖ͯ͠·͏...ɻ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 20 / 28
ೝূ ͱ͍͏͜ͱͰɺೝূγεςϜΛ࡞Γ·͠ΐ͏ɻ ࠓճ Authorization ϔομʔΛͬͨೝূΛ͢Δ (RFC7235)ɻ ϦΫΤετϔομʔʹɺ Authorization: Bearer access token ΛೖΕɺ access token ʹΑͬͯೝূΛߦ͏ํࣜɻ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 21 / 28
ೝূ Listing 1: main.go 1 func main() { 2 r := gin.Default() 3 r.Use(Auth()) 4 // (ommited) 5 r.Run() 6 } 7 8 func Auth() gin.HandlerFunc { 9 return func(c *gin.Context) { 10 token := c.Request.Header.Get("Authorization") 11 12 if token != "Bearer token" { 13 c.AbortWithStatus(401) 14 } 15 c.Next() 16 } 17 } firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 22 / 28
࣮ԋ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 23 / 28
࣮ԋ ࣮ࡍʹݟ͍͖ͯͨͩ·͢ɻ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 24 / 28
͜ΕͰ ͜ΕͰɺ༑ਓ͕དྷͨ࣌҆৺ͯ͠ wi-fi Λି͢͜ͱ͕Ͱ͖·͢ʂ (͑ͬʁ SSL Խ௨৴͍ͯ͠ͳ͍ͬͯʁ ܅ͷΑ͏ͳצͷ͍͍ΨΩ ݏ͍ͩΑ) firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 25 / 28
·ͱΊ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 26 / 28
·ͱΊ ·ͱΊ ▶ ΒΕͨ͘ͳ͍ใͷೝূେʂ ▶ Midas DB ϑϩϯτ API ͳͲΛࣗͰઃܭͰָ͖͍ͯ͠ ࠓޙͷల։ (Midas) ▶ ·ͩ·ͩϑϩϯτ͕શવͳͷͰͦ͜Λॆ࣮͍͖͍ͤͯͨ͞ ▶ Docker Ͱىಈ͍ͤͨ͞ ࠓޙͷల։ (Golang) ▶ ରہ࣌ܭͷϓϩάϥϛϯά͕͍ͨ͠ firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 27 / 28
ιʔείʔυ Misuzu (Golang): https://github.com/firedial/midas-misuzu Nagisa (Elm): https://github.com/firedial/midas-nagisa firedial (DesignOne Go #5) ՈܭཧγεςϜ Midas ʹ͍ͭͯ September 25, 2019 28 / 28