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.8k
Other Decks in Programming
See All in Programming
Outline View in SwiftUI
1024jp
1
330
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
2
1.1k
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
Realtime API 入門
riofujimon
0
150
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
as(型アサーション)を書く前にできること
marokanatani
10
2.6k
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
120
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
210
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.7k
Jakarta EE meets AI
ivargrimstad
0
610
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
900
Contemporary Test Cases
maaretp
0
140
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Ruby is Unlike a Banana
tanoku
97
11k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Unsuck your backbone
ammeep
668
57k
Making Projects Easy
brettharned
115
5.9k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Raft: Consensus for Rubyists
vanstee
136
6.6k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Optimizing for Happiness
mojombo
376
70k
Six Lessons from altMBA
skipperchong
27
3.5k
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*Խ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠