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
老舗15年のwebメディアをAPIサーバー化した話
Search
Makoto Shiga
January 28, 2017
Programming
0
120
老舗15年のwebメディアをAPIサーバー化した話
DevLOVE199 越境CON の30min セッショントークの内容です。
Makoto Shiga
January 28, 2017
Tweet
Share
More Decks by Makoto Shiga
See All by Makoto Shiga
エンジニアがドメインロジックに 集中するためのコアパッケージ整備 / freee prepare a core package for microservice
macotasu
2
5.9k
Other Decks in Programming
See All in Programming
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
360
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
110
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.6k
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
1
600
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
270
良いユニットテストを書こう
mototakatsu
5
2.1k
Haze - Real time background blurring
chrisbanes
1
510
103 Early Hints
sugi_0000
1
230
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
선언형 UI에서의 상태관리
l2hyunwoo
0
160
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
150
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Adopting Sorbet at Scale
ufuk
73
9.1k
Why Our Code Smells
bkeepers
PRO
335
57k
RailsConf 2023
tenderlove
29
940
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
170
Rails Girls Zürich Keynote
gr2m
94
13k
Mobile First: as difficult as doing things right
swwweet
222
9k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Docker and Python
trallard
42
3.1k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Transcript
ฮͷXFCϝσΟΞΛ "1*αʔόʔԽͨ͠ %FW-07& ӽڥ$0/ !NBDPUBTV
ࣗݾհ
!NBDPUBTV HJUIVC.BDP5BTV UXJUUFSIUUQTUXJUUFSDPN.BDP@5BTV DIJFGFOHJOFFS
BOJNBUF5JNFT ͔ΒใΛൃ৴͍ͯ͠ΔXFCϝσΟΞ ༏Ξχϝχϡʔε Ξχϝಈը ༏ϥδΦ 17৴ νέοτ FUDʜ ΞχϝใΛຖൃ৴ɺಡऀʹ͓ಧ͚͍ͯ͠Δ
IUUQXXXBOJNBUFUJNFTDPN
ࡢ݄ʹΞϓϦΛϦϦʔε
ຊ "1*Խ͢ΔͨΊͷΞϓϩʔν
ࡢ݄̓ʹ্͔Β͓ୡ͕͋͠Γ·ͨ͠ ΞϓϦԽͷܦҢ
ЊʮΞχϝΠτλΠϜζͷΞϓϦΛ࡞ͬͯ ΄͍͠ɻ݄ϦϦʔεඪͰͬͯΈͯʯ ΞϓϦԽͷܦҢ
ЊЊЊͳɺͳΜͩͬͯʔʂʁ ΞϓϦԽͷܦҢ
ݱঢ়ͷαΠτΑΓշదʹ͑Δ ΞϓϦԽͰͷϛογϣϯ
w XFCWJFXͩͱαΠτΛεϚϗͷϒϥβͰΈΔͷͱมΘΒͳ͍ w ΞϓϦͰͷද͕ࣔXFCWJFXͷ࣌ͱ"1*ͰKTPOͰΛฦͨ͠ ߹Ͱഒ͕ҧͬͨ IUUQEFWFMPQFSBOJNBUFMBCDPNFOUSZ ΑΓշదʹ ͬͺΓXFCWJFX͡Όͳͯ͘"1*͡Όͳ͖Όշదʹ ͳΒͳ͍Ͷ
͔Βಈ͍͍ͯΔͷͰΘΓͱʁϨΨγʔ ΞχϝΠτλΠϜζͷݱঢ় w Ṗͳίʔυ͕ͨ͘͞Μ w /P'SBNFXPSLͰࢄΒ͍ͬͯΔQIQϑΝΠϧ w ٺԽͨ͠αʔόʔ w ։ൃڥ͕ͳ͍ʹ͍͠
w FUD
͜ͷڥʹ࡞Ζ͏ͱ͢Δͱ ʹऴΘΒͳ͍ͷͰʁ
࡞ઓ XFCϝσΟΞຊମͱ"1*ผΞϓϦͱͯ͠ੈքΛ͚Δ
ੈքΛ͚ΔϝϦοτσϝϦοτ w ຊମڥͷঢ়ଶΛؾʹͤͣʹ࣮Ͱ͖Δ w ΞΫηε͕૿͑ͨ࣌ʹ྆ܥ͕ࢮ͵ͷΛආ͚Δ w Ұ͔Β࡞ΔͷͰɺṖͷଟ͍ίʔυͷղੳʹ࣌ؒΛ Θͣɺ"1*Λ࡞Δ͜ͱʹઐ೦Ͱ͖Δ ϝϦοτ σϝϦοτ
w ͪΐͬͱ͓͔͔ۚΔ w ӡ༻ίετ૿͑Δ
"1*αʔόʔͷಈ࡞ڥ w MBOHVBHF3VCZ w TFSWFSQVNB w GSBNFXPSLHSBQF
w ϝσΟΞຊମ͔Βੜ͞ΕͨσʔλΛࢀর͢Δ w औಘͨ͠هࣄσʔλΛKTPOʹͯ͠ฦ͢ "1*Խʹඞཁͳ͜ͱ
"1*Խʹඞཁͳ͜ͱ w ϝσΟΞຊମ͔Βੜ͞ΕͨσʔλΛࢀর͢Δ w औಘͨ͠هࣄσʔλΛKTPOʹͯ͠ฦ͢
"1*Խʹඞཁͳ͜ͱ w ϝσΟΞຊମ͔Βੜ͞ΕͨσʔλΛࢀর͢Δ w औಘͨ͠هࣄσʔλΛKTPOʹͯ͠ฦ͢
هࣄσʔλΛࢀর͢Δ
هࣄσʔλΛࢀর͢Δ CREATE TABLE `article` ( `id` int(10) NOT NULL, `body_1`
text NOT NULL, `body_2` longtext, `public_flag` int(1) NOT NULL DEFAULT '0', `start_at` datetime NOT NULL, `end_at` datetime NOT NULL, `category_a` int(10) NOT NULL, `category_b` int(10) NOT NULL, `category_c` int(10) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime DEFAULT NULL, PRIMARY KEY (`id`), ) ENGINE=MyISAM DEFAULT CHARSET=utf8; هࣄσʔλͷςʔϒϧ
هࣄσʔλΛࢀর͢Δ CREATE TABLE `article` ( `id` int(10) NOT NULL, `body_1`
text NOT NULL, `body_2` longtext, `public_flag` int(1) NOT NULL DEFAULT '0', `start_at` datetime NOT NULL, `end_at` datetime NOT NULL, `category_a` int(10) NOT NULL, `category_b` int(10) NOT NULL, `category_c` int(10) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime DEFAULT NULL, PRIMARY KEY (`id`), ) ENGINE=MyISAM DEFAULT CHARSET=utf8; هࣄσʔλͷςʔϒϧ )5.-͕ͦͷ·· ͍ͬͯΔ
هࣄσʔλΛࢀর͢Δ CREATE TABLE `article` ( `id` int(10) NOT NULL, `body_1`
text NOT NULL, `body_2` longtext, `public_flag` int(1) NOT NULL DEFAULT '0', `start_at` datetime NOT NULL, `end_at` datetime NOT NULL, `category_a` int(10) NOT NULL, `category_b` int(10) NOT NULL, `category_c` int(10) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime DEFAULT NULL, PRIMARY KEY (`id`), ) ENGINE=MyISAM DEFAULT CHARSET=utf8; هࣄσʔλͷςʔϒϧ ΧςΰϦʔ͕ ̏ͭೖΔ
ͱ͋ΔهࣄͷΧςΰϦʔ
ΧϥϜ͕̏ͭͳͷʹͭҎ্ΧςΰϦʔ ͕͋Δͧʁ
هࣄσʔλΛࢀর͢Δ هࣄʹؔ࿈͢ΔΧςΰϦʔ͕͍Δςʔϒϧ͕·ͩ͋ͬͨ CREATE TABLE `article_attribute` ( `id` int(11) NOT NULL
COMMENT 'article id', `key` varchar(30) NOT NULL COMMENT 'category', `key_int` int(11) NOT NULL COMMENT ‘category id', KEY (`id`,`key`), ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
هࣄσʔλΛࢀর͢Δ CREATE TABLE `category` ( `id` int(11) NOT NULL, `name`
varchar(30) NOT NULL, PRIMARY KEY (`id`), ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
"1*ଆͰςʔϒϧߏΛมߋ͢Δ
"1*ଆͰςʔϒϧߏΛมߋ͢Δ ຊମଆ͔ΒσʔλΛࢀর͠ɺਖ਼نԽͯ͠Ω ϨΠʹͨ͠ঢ়ଶͰผͷ%#ʹೖΕΔ
ςʔϒϧߏͷมߋ CREATE TABLE `article` ( `id` int(10) NOT NULL, `headline`
text NOT NULL, `body` longtext, `public_flag` int(1) NOT NULL DEFAULT '0', `start_at` datetime NOT NULL, `end_at` datetime NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime DEFAULT NULL, PRIMARY KEY (`id`), ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `article_categories` ( `article_id` int(11) NOT NULL, `category_id` int(11)
NOT NULL, PRIMARY KEY (`category_id`,`article_id`), ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ςʔϒϧߏͷมߋ
ෛ࠴Λͭড়Խͨͧ͠
"1*Ͱͷهࣄύʔε
هࣄσʔλΛύʔε͢Δ
ύʔε࣌ʹٻΊΒΕΔ͜ͱ w ෆཁͳλάใফ͢ CςΩετCςΩετ w ඞཁͳଐੑΛ͚ͭͯฦ͢ ˙λΠτϧখݟग़͠จࣈ ZPVUVCFϦϯΫಈը JNHը૾ w
)5.-Λ+40/ʹ͢Δ
[ { "type": "headline", "value": “title dayo" }, { "type":
"image", "value": “https://…” }, { "type": "link", "value": “https://…” }, … ]
1BSTFS HFUUBMPOHLSBNEPXO
1BSTFS ਤࢀরIUUQTLSBNEPXOHFUUBMPOHPSH
LSBNEPXO w ,SBNEPXO1BSTFS#BTF ,SBNEPXO$POWFSUFS#BTFΛܧঝ͢Δ͜ͱͰ ύʔεɺग़ྗͷ֦ு͕Ͱ͖Δ w நߏจΛग़ྗͰ͖Δ LSBNEPXOUP+40/ͷॲཧ͕Ͱ͖ͦ͏
ݹ͍ϝσΟΞ͋Δ͋Δ <b><span class="txt_blue">title</span></b> ྫ খݟग़͠ w $.4ͷೖྗαϙʔτػೳ͕ऑ͘ɺਓʹΑͬͯඍົ ʹIUNMͷॻ͖ํ͕ҧ͏
ݹ͍ϝσΟΞ͋Δ͋Δ w $.4ͷೖྗαϙʔτػೳ͕ऑ͘ɺਓʹΑͬͯඍົ ʹIUNMͷॻ͖ํ͕ҧ͏ <b><span class="txt_blue">title</span></b> <span class="txt_blue">title</span> ྫ
খݟग़͠
ݹ͍ϝσΟΞ͋Δ͋Δ <b><span class="txt_blue">title</span></b> <span class="txt_blue">title</span> <font color="blue">title</font> ྫ
খݟग़͠ w $.4ͷೖྗαϙʔτػೳ͕ऑ͘ɺਓʹΑͬͯඍົ ʹIUNMͷॻ͖ํ͕ҧ͏
ݹ͍ϝσΟΞ͋Δ͋Δ <b><span class="txt_blue">title</span></b> <span class="txt_blue">title</span> <font color="blue">title</font>
title: ྫ খݟग़͠ w $.4ͷೖྗαϙʔτػೳ͕ऑ͘ɺਓʹΑͬͯඍົ ʹIUNMͷॻ͖ํ͕ҧ͏
ݹ͍ϝσΟΞ͋Δ͋Δ <b><span class="txt_blue">title</span></b> <span class="txt_blue">title</span> <font color="blue">title</font>
title: etc… ྫ খݟग़͠ w $.4ͷೖྗαϙʔτػೳ͕ऑ͘ɺਓʹΑͬͯඍົ ʹIUNMͷॻ͖ํ͕ҧ͏
808
ϑΥʔϚοτ౷Ұ͠Α͏
ϑΥʔϚοτ౷Ұ ಡऀʹͱͬͯѹతʹಡΈ͘͢ͳΔͷͰͬͯଛ ͳ͍
ϑΥʔϚοτ౷Ұͷํ๏ w ϥΠλʔ͞Μʹࠓޙͷೖྗํ๏ͷมߋͷप ࠓޙখݟग़͠TQBODMBTTlUYU@CMVFzUJUMFTQBO ʹͯ͘͠Ε·ͤΜ͔ʜ w աڈهࣄʹ͍ͭͯϑΟʔϚοτἧ͍͑ͨͳʜ Ұهࣄͣͭͳ͓͚ͯ͠·ͤΜ͔ʜ
ϑΥʔϚοτ౷Ұͷํ๏ w ϥΠλʔ͞Μʹࠓޙͷೖྗํ๏ͷมߋͷप ࠓޙTQBODMBTTlUYU@CMVFzUJUMFTQBOʹͯ͘͠ Ε·ͤΜ͔ʜ w աڈهࣄʹ͍ͭͯϑΟʔϚοτἧ͍͑ͨͳʜ Ұهࣄͣͭͳ͓͚ͯ͠·ͤΜ͔ʜ
օʹͱ݈ͬͯશͳํ๏͡Όͳ͍
ϑΥʔϚοτ౷Ұͷํ๏ w ϥΠλʔ͞Μʹࠓޙͷೖྗํ๏ͷมߋͷप $.4ػೳͰೖྗαϙʔτͷڧԽ w աڈهࣄʹ͍ͭͯϑΥʔϚοτἧ͍͑ͨͳʜ ύʔεͰ͕ΜΔ ٕज़Ͱղܾ͢Δ
ϑΥʔϚοτ౷Ұͷํ๏ w ϥΠλʔ͞Μʹࠓޙͷೖྗํ๏ͷมߋͷप $.4ػೳͰೖྗαϙʔτͷڧԽ w աڈهࣄʹ͍ͭͯϑΟʔϚοτἧ͍͑ͨͳʜ ύʔεͰ͕ΜΔ ٕज़Ͱղܾ͢Δ
ύʔεͰ͕ΜΔྨ͚͢Δ <b><span class="txt_blue">title</span></b> <span class="txt_blue">title</span>
<font color="blue">title</font> title: etc… খݟग़͠ ࠇจࣈςΩετ
,SBNEPXOͰύʔε ਖ਼نදݱͰখݟग़͠Λผ BOLD_HEADLINE_START # When this matches, type=headline = /^(?:<b>)?<span\s+class=(?<quote>["']?)txt_blue\k<quote+0>>/i
BOLD_HEADLINE_MATCH # select text = %r{^(?:<b>)?(?<text><span\s+class=(? <quote>["']?)txt_blue\k<quote+0>>((?:.|\n)+?)</span>)(?:</b>)?\n}i { "type": "headline", "value": "title" }
,SBNEPXOͰύʔε ਖ਼نදݱͰԿʹϚον͠ͳ͍IUNMλά ௨ৗͷςΩετʹ͢Δ { "type": "text", "value": "title" } 3"8@)5.-@5"(@45"35
UBH@OBNF aT
,SBNEPXOͰύʔε w Bλά w JNHλά w ZPVUVCF w UXJUUFS w
খݟग़͠ w ৭͖ݟग़͠ w ͦͷଞͨͩͷจࣈྻ ࡞ͬͨओͳྨΘ͚ͷఆٛ
ࢥͬͨΑΓҧײ͕ͳ͍ ݟͨͷهࣄʹͳͬͨ
݁ՌΞϓϦͰΈͯΈͶ
"1*αʔόʔԽͨ͠Ըܙ w ൚༻"1*αʔόʔͱͯ͠࡞ͬͨͷͰ৭ʑͳ͜ͱʹ ͑Δ༨͕Ͱ͖ͨ ࠓ·Ͱຊମͷѻ͍ʹ͍͘σʔλͷ͍ͤͰɺͰ͖ͳ ͔ͬͨ͜ͱ"1*αʔόʔ͏͜ͱͰ࣮ݱ͘͢͠ ͳͬͨ ࣮ࡍʹԣͷαʔϏεͰ͔ͭ͏Ͱ͍ͯΔ
·ͱΊ w ຊମͱ"1*ͰੈքΛ͚Δ͜ͱͰɺݱঢ়ҡ࣋ͭͭ͠ ৽͍͜͠ͱ͕͘͢͠ͳͬͨ w "1*αʔόʔΛ࡞͓͔ͬͨ͛ͰαʔϏεʹ͍Ζ͍Ζ ͳՄೳੑ͕Ͱ͖ͨ w "1*αʔόʔԽͷաఔͰɺٕज़తෛ࠴ɾӡ༻໘ͷෛ ࠴ͳͲཧ͖͠߹͍ɺαʔϏεͷ্࣭ʹͭ
ͳ͕ͬͨ
-FU`T"1*Խ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠