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
310
Other Decks in Programming
See All in Programming
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
Arm移行タイムアタック
qnighy
0
350
デザインパターンで理解するLLMエージェントの作り方 / How to develop an LLM agent using agentic design patterns
rkaga
9
940
DevTools extensions で 独自の DevTool を開発する | FlutterKaigi 2024
kokiyoshida
0
120
RubyLSPのマルチバイト文字対応
notfounds
0
120
CSC509 Lecture 12
javiergs
PRO
0
160
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
Welcome JSConf.jp 2024
yosuke_furukawa
PRO
0
130
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Micro Frontends Unmasked Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
120
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
140
Featured
See All Featured
Scaling GitHub
holman
458
140k
Speed Design
sergeychernyshev
25
620
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Adopting Sorbet at Scale
ufuk
73
9.1k
Facilitating Awesome Meetings
lara
50
6.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Agile that works and the tools we love
rasmusluckow
327
21k
Fireside Chat
paigeccino
34
3k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
A Tale of Four Properties
chriscoyier
156
23k
Teambox: Starting and Learning
jrom
133
8.8k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
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