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
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
CSC509 Lecture 12
javiergs
PRO
0
160
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
最新TCAキャッチアップ
0si43
0
140
距離関数を極める! / SESSIONS 2024
gam0022
0
280
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
690
Ethereum_.pdf
nekomatu
0
460
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
Jakarta EE meets AI
ivargrimstad
0
180
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
130
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
96
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
GraphQLとの向き合い方2022年版
quramy
43
13k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
For a Future-Friendly Web
brad_frost
175
9.4k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Bash Introduction
62gerente
608
210k
Automating Front-end Workflow
addyosmani
1366
200k
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