Slide 1

Slide 1 text

͙͢࢖͑Δ$MPVE fl BSF8PSLFSTʂ $MPVE fl BSF.FFUVQ0LJOBXB7PM 


Slide 2

Slide 2 text

!DPEFIFY !$PEF)FY w /05")05&-Ͱಇ͍͍ͯ·͢ w 1P$Λ࡞ͬͯɺӡ༻·Ͱ͍࣋ͬͯ͘ w ࣗಈԽɺ"*ΠϯςάϨʔγϣϯ w ͓٬༷޲͚ɺࣾ಺޲͚

Slide 3

Slide 3 text

͙͢ʹ࢖ָ͍͑ͯ͠ʂ

Slide 4

Slide 4 text

͙͢ʹ࢖ָ͍͑ͯ͠ʂ w σϓϩΠ͢Ε͹͙͢ʹ࢖͑Δʂ w ؆୯ͳ+BWB4DSJQUͷίʔυ͚ͩͰ΋࢖͑Δʂ w ࢝ΊΔͨΊʹ֮͑Δ͜ͱ͕গͳ͍ʂ w ૣ͍ʂʂ

Slide 5

Slide 5 text

IUUQTTQFBLFSEFDLDPNDPEFIFYDMPVE fl BSFXPSLFSTIBMFTJJ

Slide 6

Slide 6 text

ΞϓϦέʔγϣϯͷ։ൃ؀ڥΛ੔͑Δ ίϯςφΛ࢖ͬͨ؀ڥͱͷൺֱ

Slide 7

Slide 7 text

ίϯςφ࣌୅ͷ։ൃ؀ڥ

Slide 8

Slide 8 text

ίϯςφ࣌୅ͷ։ൃ؀ڥ w ։ൃ؀ڥΛ੔͑Δͷ͸໘౗͍͘͞ʂ w 
 w 


Slide 9

Slide 9 text

ίϯςφ࣌୅ͷ։ൃ؀ڥ w ։ൃ؀ڥΛ੔͑Δͷ͸໘౗͍͘͞ʂ w %PDLFS fi MFͷهड़ɺΞϓϦΛಈ͔ͨ͢Ίͷઃఆ ϑΝΠϧͷهड़ɺ؀ڥม਺ͳͲ w 


Slide 10

Slide 10 text

ίϯςφ࣌୅ͷ։ൃ؀ڥ w ։ൃ؀ڥΛ੔͑Δͷ͸໘౗͍͘͞ʂ w %PDLFS fi MFͷهड़ɺΞϓϦΛಈ͔ͨ͢Ίͷઃఆ ϑΝΠϧͷهड़ɺ؀ڥม਺ͳͲ w %#ͩͬͨΓ2VFVFͩͬͨΓɺ$SPO+PCͳͲ ΛϩʔΧϧͰ༻ҙ͢Δͷ΋େม

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

֮͑Δ͜ͱ͕͍ͬͺ͍ʂʂ

Slide 13

Slide 13 text

$MPVE fl BSF8PSLFSTͷ৔߹

Slide 14

Slide 14 text

$MPVE fl BSF8PSLFSTͷ৔߹ w ։ൃ؀ڥ͸ςϯϓϨʔτΛ࢖ͬͯηοτΞοϓՄೳ w ։ൃ؀ڥͱσϓϩΠ؀ڥͷဃ཭͕গͳ͍ w ϥϯλΠϜͷXPSLFSE͸044 
 IUUQTHJUIVCDPNDMPVE fl BSFXPSLFSE w Πϯϑϥͷػೳ΋XPSLFSEΛܦ༝ͯ͠ར༻Ͱ͖Δ

Slide 15

Slide 15 text

ΞϓϦέʔγϣϯͷ։ൃ؀ڥΛ੔͑Δ $ npx create-cloudflare my-app --framework hono \ --deploy false

Slide 16

Slide 16 text

ΞϓϦέʔγϣϯͷ։ൃ؀ڥΛ੔͑Δ $ tree my-app --gitignore my-app ├── README.md ├── package.json ├── src │ └── index.ts ├── tsconfig.json 
 └── wrangler.toml

Slide 17

Slide 17 text

ΞϓϦέʔγϣϯͷ։ൃ؀ڥΛ੔͑Δ $ cd my-app && npm run dev 
 $ curl http://localhost:8787 
 Hello Hono!

Slide 18

Slide 18 text

w XSBOHMFSUPNMʹ͸σϓϩΠޙʹར༻͢Δ؀ڥม਺Λॻ͘ w EFWWBSTʹ͸ϩʔΧϧͰར༻͍ͨ͠؀ڥม਺Λॻ͘ ؀ڥม਺Λ੔͑Δ

Slide 19

Slide 19 text

؀ڥม਺Λ੔͑Δ $ echo "ENV = \"local\"" >> .dev.vars 
 $ ls .dev.vars .dev.vars

Slide 20

Slide 20 text

name = "my-app" compatibility_date = "2023-01-01" [vars] ENV = "development" ؀ڥม਺Λ੔͑Δ XSBOHMFSUPNM

Slide 21

Slide 21 text

import { Hono } from "hono"; const app = new Hono<{ Bindings: { ENV: string; }; }>(); app.get("/", (c) => c.text(c.env.ENV)); export default app; ؀ڥม਺Λ੔͑Δ JOEFYUT

Slide 22

Slide 22 text

؀ڥม਺Λ੔͑Δ $ cd my-app && npm run dev 
 $ curl http://localhost:8787 
 local

Slide 23

Slide 23 text

w XSBOHMFSίϚϯυΛར༻ͯ͠ϦιʔεΛ࡞੒ w ϦιʔεΛར༻͢ΔͨΊʹXSBOHMFSUPNM΁ઃఆΛهड़ w $MPVE fl BSF8PSLFSTͰར༻Ͱ͖Δϛυϧ΢ΣΞ͸ 
 جຊಉ͡ ϛυϧ΢ΣΞΛ੔͑Δ

Slide 24

Slide 24 text

ϛυϧ΢ΣΞΛ੔͑Δʢྫ,7ʣ $ npx wrangler kv:namespace create TEST_KV ⛅ wrangler 3.17.1 ------------------- 🌀 Creating namespace with title "my-app-TEST_KV" ✨ Success! Add the following to your configuration file in 
 your kv_namespaces array: { binding = "TEST_KV", id = "da56a0e3ee6641fabf26b726e60fa550" }

Slide 25

Slide 25 text

[[kv_namespaces]] binding = "TEST_KV" id = "da56a0e3ee6641fabf26b726e60fa550" XSBOHMFSUPNM ϛυϧ΢ΣΞΛ੔͑Δʢྫ,7ʣ

Slide 26

Slide 26 text

const app = new Hono<{ Bindings: { TEST_KV: KVNamespace } }>(); app.get("/counter", async (c) => { const key = c.req.query()["key"] || "defaultKey"; const count = Number(await c.env.TEST_KV.get(key)); const count = !isNaN(value) ? value + 1 : 1; await c.env.TEST_KV.put(key, String(count)); return c.text(String(count)); }); export default app; JOEFYUT ϛυϧ΢ΣΞΛ੔͑Δʢྫ,7ʣ

Slide 27

Slide 27 text

$ curl http://localhost:8787/counter 
 1 ϛυϧ΢ΣΞΛ੔͑Δʢྫ,7ʣ

Slide 28

Slide 28 text

ͪΐͬͱͨ͠Ϣʔεέʔε /05")05&-ͷ৔߹

Slide 29

Slide 29 text

$034ͷϔομ௥Ճ

Slide 30

Slide 30 text

$034ͷϔομ௥Ճ

Slide 31

Slide 31 text

$034ͷϔομ௥Ճ

Slide 32

Slide 32 text

໰͍߹Θͤͷϝλ৘ใ௥Ճ

Slide 33

Slide 33 text

w ΞϓϦ͔Β;FOEFTLͷ໰͍߹ΘͤϑΥʔϜ΁ͷ 
 ಋઢ͕༻ҙ͞Ε͍ͯΔ w ϩάΠϯதͷͲͷ͓٬༷͔Βͷ͓໰͍߹Θ͔ͤ 
 ೺Ѳ͍ͨ͠ w ؔ࿈͢Δ৘ใ΋஌Γ͍ͨ 
 ໰͍߹Θͤͷϝλ৘ใ௥Ճ

Slide 34

Slide 34 text

໰͍߹Θͤͷϝλ৘ใ௥Ճ

Slide 35

Slide 35 text

w ΞϓϦ͔Βͷಋઢ͸શͯ$MPVE fl BSF8PSLFSTͷ 
 63-Λࢦఆ͢Δ w ϝλ৘ใ͸63-ΫΤϦύϥϝʔλʔʹηοτ͢Δ w 8PSLFS্ͰΫΤϦύϥϝʔλʔͱҰக͢Δ 
 νέοτϑΟʔϧυ൪߸΁ࠩ͠ସ͑Δ UG@ ໰͍߹Θͤͷϝλ৘ใ௥Ճ

Slide 36

Slide 36 text

ϝϯςφϯεϞʔυ

Slide 37

Slide 37 text

ϝϯςφϯεϞʔυ IUUQTTQFBLFSEFDLDPNDPEFIFYHSQDDMJFOUPODMPVE fl BSFXPSLFST

Slide 38

Slide 38 text

$IBU(151SPYZ

Slide 39

Slide 39 text

w (15TͷΞΫγϣϯ͔Β/05")05&-"1*Λ 
 ར༻͢ΔͨΊͷ1SPYZ w $IBU(15͸0"VUIೝূΛఏڙ͍ͯ͠ΔͷͰ 
 ϩάΠϯ͕Ͱ͖Ε͹/")"1*Λ࢖͑Δ w "1*ͱ0"VUIαʔόʔ͸ಉ͡3PPU63-͡Όͳ͍ͱ ར༻Ͱ͖ͳ੍͍ݶ͕͋ΔͨΊ $IBU(151SPYZ

Slide 40

Slide 40 text

$IBU(151SPYZ w BVUIPSJ[BUJPOͱUPLFOΛఏڙ w 4DPQF͸'JSFCBTF"VUIͰඞཁͳ 
 ಺༰Λೖྗ͢Δ

Slide 41

Slide 41 text

$IBU(151SPYZ

Slide 42

Slide 42 text

%ZOBNJD-JOLT

Slide 43

Slide 43 text

w 'JSFCBTFͰఏڙ͞Ε͍ͯΔػೳ w %ZOBNJD-JOLT͸ഇࢭ༧ఆ w ϢχόʔαϧϦϯΫͷ࢓༷ʹԊͬͯ։ൃ͢Δඞ ཁ͕͋ͬͨ w ϦϯΫΛ։͘ͱɺରԠ͢ΔΞϓϦ͕ىಈ ͞Εɺͦͷը໘Λ։͘͜ͱ͕Ͱ͖Δ w ΋ͪΖΜϓϨϏϡʔը໘΋͋Δ %ZOBNJD-JOLT

Slide 44

Slide 44 text

%ZOBNJD-JOLT w ୹ॖ63-Λൃߦ͢ΔΠϝʔδ w 63-ʹ࢖͏จࣈྻ͕ඃΒͳ͍Α͏ʹ 
 %VSBCMF0CKFDUTͷτϥϯβΫγϣϯΛར༻ w )POPΛ࢖ͬͯɺϓϨϏϡʔը໘ͱࣝผࢠͷ৘ใΛؚ Ίͨ+40/ϑΝΠϧʢ"TTFU-JOL fi MFʣΛฦ͢

Slide 45

Slide 45 text

ΧελϚΠζ ֎෦ͷσʔλετϨʔδΛ࢖͏

Slide 46

Slide 46 text

ίϯγΣϧδϡϓϥοτϑΥʔϜ

Slide 47

Slide 47 text

֎෦ͷϩάج൫Λ࢖͏ ($1$MPVE-PHHJOH

Slide 48

Slide 48 text

ʜͷલʹ-PH1VTIͷ঺հ

Slide 49

Slide 49 text

-PH1VTI

Slide 50

Slide 50 text

w $MPVE fl BSFʹؔ࿈ͨ͠ϩάΛ࿈ܞͰ͖Δ 
 ετϨʔδ΁ϩάΛૹΓ͚ͭΔػೳ w $MPVE fl BSF8PSLFSTͷ৔߹͸DPOTPMFMPHͷ 
 த਎Λ1VTIͰ͖Δ -PH1VTI

Slide 51

Slide 51 text

-PH1VTI

Slide 52

Slide 52 text

-PH1VTI

Slide 53

Slide 53 text

-PH1VTI

Slide 54

Slide 54 text

-PH1VTI

Slide 55

Slide 55 text

-PH1VTI

Slide 56

Slide 56 text

ࣗ෼ͰϩάΛૹΔ

Slide 57

Slide 57 text

w ͓ͦΒ͘།Ұͷऑ఺ w $MPVE fl BSFͷΈͩͱϩάΛ୳͢ͷʹۤ࿑͢Δ w ͏ͪͷϢʔεέʔεͩͱ$MPVE-PHHJOHΛܦ༝ͯ͠ 
 ௚઀ૹΔํ͕͍҆ ࣗ෼ͰϩάΛૹΔ

Slide 58

Slide 58 text

2VFVFͰϩάΛૹ৴͢Δ

Slide 59

Slide 59 text

w ($1ͷ$MPVE-PHHJOH΁ૹ৴͢Δ w ࠓͩͱ5BJM8PSLFSTΛར༻͢Δͷ͕Φεεϝ͔΋ 2VFVFͰϩάΛૹ৴͢Δ

Slide 60

Slide 60 text

2VFVFͰϩάΛૹ৴͢Δ w 4DPQFΛهड़ w $MPVE-PHHJOHͷ"1*΁ ϦΫΤετ͢Δ

Slide 61

Slide 61 text

2VFVFͰϩάΛૹ৴͢Δ w -PHHFS$MBTT w ഑ྻΛ࣋ͭϓϩύςΟ FOUSJFT w "1*ϋϯυϥͰ͸ 
 ͜ͷϝιουΛݺͼग़͢

Slide 62

Slide 62 text

2VFVFͰϩάΛૹ৴͢Δ w "1*ͷॲཧͷ࠷ޙʹ 
 FOUSJFTΛΩϡʔʹૹ৴͢Δ w όοναΠζͷ্ݶ͸ 
 NFTTBHFT

Slide 63

Slide 63 text

2VFVFͰϩάΛૹ৴͢Δ w $POTVNFSͰϝοηʔδΛ 
 ड৴͢Δ w $MPVE-PHHJOH΁ૹ৴ 


Slide 64

Slide 64 text

֎෦ͷΩϡʔΛ࢖͏ $MPVE5BTLTͷซ༻

Slide 65

Slide 65 text

8PSLFST2VFVF CFUB ͕ෆ҆ఆ

Slide 66

Slide 66 text

8PSLFST2VFVF͕ෆ҆ఆ ͨ·ʹΩϡʔ͕٧·Δ

Slide 67

Slide 67 text

8PSLFST2VFVF͕ෆ҆ఆ αʔόʔ͔ΒͷλΠϜΞ΢τ͸ͳ͍

Slide 68

Slide 68 text

w $MPVE fl BSF8PSLFST্ʹඇಉظ޲͚ͷ 
 ΤϯυϙΠϯτΛ࡞੒͢Δ w 8PSLFSTܦ༝Ͱ5BTLΛ࡞੒͢Δ w ࡞੒͞Εͨ5BTLΛ΋ͱʹ$MPVE5BTLTܦ༝Ͱ 
 ΤϯυϙΠϯτ͕ୟ͔ΕΔ $MPVE5BTLTΛ࢖͏

Slide 69

Slide 69 text

$MPVE5BTLTΛ࢖͏

Slide 70

Slide 70 text

͙͢ʹ࢖ָ͍͑ͯ͠🔥

Slide 71

Slide 71 text

͙͢ʹ࢖ָ͍͑ͯ͠🔥 w ։ൃͨ͠ΞϓϦΛ୭͔ʹ࢖ͬͯ΋Β͏·Ͱͷ 
 εςοϓ͕୹͘ͳͬͨ w ։ൃˠϦϦʔεˠϑΟʔυόοΫʢϧʔϓʣ w ΍Γ͍ͨ͜ͱͷຊ࣭ʹूதͰָ͖͍ͯ͠ʂʂ