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
Serverless Frameworkで フロント主導なAPI開発
Search
Hidetaka Okamoto
December 31, 2017
Technology
0
370
Serverless Frameworkで フロント主導なAPI開発
Serverless 勉強会@京都 vol.1
Hidetaka Okamoto
December 31, 2017
Tweet
Share
More Decks by Hidetaka Okamoto
See All by Hidetaka Okamoto
OpenAI APIで API Changelogを要約してみた話 / chatgpt-osaka-1
hideokamoto
0
460
コミュニティ運営から 中の人に変わって感じたこと
hideokamoto
0
53
Developerが Developer Advocateになった話 / dev-rel-meetup-tokyo-71
hideokamoto
0
270
Jamstack開発者のための App Runner入門
hideokamoto
1
420
WordPressでの webサイト制作2022 / ngk2022s
hideokamoto
0
380
JavaScript(TypeScript)で メディアサイトを インフラから構築する方法 / jsconf-jp-2021
hideokamoto
2
4k
AWS上でStripeを利用したアプリをより安全にデプロイする方法 /jaws-pankration-2021
hideokamoto
1
170
Shifter Headlessと Headless WordPressの紹介
hideokamoto
0
1.6k
Stripe & Next.js + AWS Amplify で会員 + 定期課金機能 / JP_Stripes20210903
hideokamoto
7
3k
Other Decks in Technology
See All in Technology
社内で最大の技術的負債のリファクタリングに取り組んだお話し
kidooonn
1
550
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
200
DMARC 対応の話 - MIXI CTO オフィスアワー #04
bbqallstars
1
160
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
120
サイバーセキュリティと認知バイアス:対策の隙を埋める心理学的アプローチ
shumei_ito
0
380
複雑なState管理からの脱却
sansantech
PRO
1
140
The Role of Developer Relations in AI Product Success.
giftojabu1
0
120
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
2
600
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.1k
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
170
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
250
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
Featured
See All Featured
A designer walks into a library…
pauljervisheath
204
24k
Facilitating Awesome Meetings
lara
50
6.1k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
A Tale of Four Properties
chriscoyier
156
23k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
How to Ace a Technical Interview
jacobian
276
23k
How STYLIGHT went responsive
nonsquared
95
5.2k
Visualization
eitanlees
145
15k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Transcript
4FSWFSMFTT'SBNFXPSLͰ ϑϩϯτओಋͳ"1*։ൃ 4FSWFSMFTTษڧձ!ژWPM 0LBNPUP)JEFUBLB
w 8 P S E # F O D I
ژ Ϟ σ Ϩ ʔ λ w 8 P S E 1 S F T T ຊ ޠ ϑ Υ ʔ ϥϜ ੈ w 8 P S E $ B N Q ,Z P U P ࣮ ߦ ҕ һ )JEFUBLB0LBNPUP %JHJUBMDVCF%FWFMPQFS
w "1*։ൃͱฒߦͨ͠ϑϩϯτ࣮ͭΒ͍ w ʮͭ࣌ؒʯͱʮϞοΫ࣮ʯ͕ಛʹͭΒ͍ w ͩͬͨΒ͔ͬͪ͜Β࡞ͬͪΌ͑ʂ ·ͱΊ
w "1*Λ͏αʔϏε։ൃͷͭΒΈ w ͳ͍"1*Λ͚ͭͩ͏Ί͍ͨ w "844FSWFSMFTT'8Ͱ࡞ΔϞοΫ"1* w ϞοΫۦಈͰϑϩϯτओಋͷ։ൃΛ ΞδΣϯμ
w "1*Λ͏αʔϏε։ൃͷͭΒΈ w ͳ͍"1*Λ͚ͭͩ͏Ί͍ͨ w "844FSWFSMFTT'8Ͱ࡞ΔϞοΫ"1* w ϞοΫۦಈͰϑϩϯτओಋͷ։ൃΛ ΞδΣϯμ
w ্࢘ɿ͜ͷ"1*ͱ࿈ܞͨ͠ػೳ࡞ͬͯ w ࣗɿ"1*ͲΕୟ͚͍͍͔ͬ͢ʁ w ্࢘ɿ·ͩͳ͍ɻ͚Ͳͬͯ w ࣗɿʮʯ લ৬ͱ͔Ͱ͋ͬͨ͜ͱ
w ͳ͍"1*͚ͨͨͳ͍ w ࣗͰ"1*αʔόʔ࡞Δͷେม͗͢Δ w +40/ϕλଧͪͰͱΓ࣮͋͑ͣ͢Δ w ඇಉظॲཧͷߟྀ࿙Εͱ͔ͰόάΛग़͢ ͭΒ͍ͭ
w "1*Λ͏αʔϏε։ൃͷͭΒΈ w ͳ͍"1*Λ͚ͭͩ͏Ί͍ͨ w "844FSWFSMFTT'8Ͱ࡞ΔϞοΫ"1* w ϞοΫۦಈͰϑϩϯτओಋͷ։ൃΛ ΞδΣϯμ
w "1*࡞Δͱ͍͑3VCZPO3BJMTͱ͔༗໊ w 8PSE1SFTTͱ͔%SVQBMͰ࡞ΕΔͬΆ͍ w ͰɺͦΕΛಈ͔͢αʔόʔʁ ࣗͰ"1*αʔόʔΛ࡞Δ͔͠ͳ͍ʁ
l z αʔόʔ͕ඞཁʹͳΔͱ ηοτΞοϓอकͷ ·ͰඞཁʹͳΔ
w "1*Λ͏αʔϏε։ൃͷͭΒΈ w ͳ͍"1*Λ͚ͭͩ͏Ί͍ͨ w "844FSWFSMFTT'8Ͱ࡞ΔϞοΫ"1* w ϞοΫۦಈͰϑϩϯτओಋͷ։ൃΛ ΞδΣϯμ
"NB[PO"1*(BUFXBZ IUUQTBXTBNB[PODPNKQBQJHBUFXBZ
l z "1*Λ؆୯ʹ࡞Δ ΫϥυαʔϏε
"1*ͷαϯϓϧ༻ҙ͞Ε͍ͯΔ IUUQTBXTBNB[PODPNKQBQJHBUFXBZ
4XBHHFSͷఆٛ༰ΛΠϯϙʔτͰ͖Δ IUUQTBXTBNB[PODPNKQBQJHBUFXBZ
"1*Λ(6*͔Β࡞Δ͜ͱ͕Ͱ͖Δ IUUQTBXTBNB[PODPNKQBQJHBUFXBZ
"1*ͷϞοΫ(6*͔Β IUUQTBXTBNB[PODPNKQBQJHBUFXBZ
Ϩεϙϯεͷ+40/Λ͏ͪ͜Ί0, IUUQTBXTBNB[PODPNKQBQJHBUFXBZ
(6*͚ͩͰϞοΫ"1*͕࡞ΕΔ IUUQTBXTBNB[PODPNKQBQJHBUFXBZ
"1*ઐ༻ͷ4%,࡞%-Ͱ͖Δ IUUQTBXTBNB[PODPNKQBQJHBUFXBZ
4%,༻ํ๏͖Ͱ%-Ͱ͖Δ ˞ͨͩ͠ӳޠͷΈ
l z ͋ͱͰ͚ସ͑Δͷ ΊΜͲ͏͔ͩΒ ͦͷ··࣮͍ͨ͠
4FSWFSMFTT'SBNFXPSL IUUQTTFSWFSMFTTDPN
l z "1*ͱόοΫΤϯυΛ ؆୯ʹ࡞ˍσϓϩΠ
ίϚϯυ̏ͭͰΠϯετʔϧ͔ΒσϓϩΠ·Ͱ IUUQTTFSWFSMFTTDPN #Install serverless globally $ npm install serverless -g
# Create a serverless function $ serverless create --template hello-world # Deploy to cloud provider $ serverless deploy # Function deployed! Trigger with live url $ curl http://xyz.amazonaws.com/hello-world
:".-Ͱઃఆ͢ΔͷͰಡΈ͘͢ॻ͖͍͢ (&5IFMMPͱ͍͏"1*͕͜Ε͚ͩͰ࡞Ͱ͖Δ functions: hello: handler: handler.hello events: - http: path:
hello method: get cors: true
ෳͷΫϥυαʔϏεʹରԠ IUUQTTFSWFSMFTTDPN
IUUQTHJUIVCDPNTFSWFSMFTTFYBNQMFT ๛ͳαϯϓϧ
w "1*Λ͏αʔϏε։ൃͷͭΒΈ w ͳ͍"1*Λ͚ͭͩ͏Ί͍ͨ w "844FSWFSMFTT'8Ͱ࡞ΔϞοΫ"1* w ϞοΫۦಈͰϑϩϯτओಋͷ։ൃΛ ΞδΣϯμ
w "1*Λ؆୯ʹ࡞ΕΔαʔϏε͕͋Δ w ศརͳσϓϩΠπʔϧ͋Δ w ͙ͭΒ͍ͳΒɺ͔ͬͪ͜Β࡞Ε͍͍ͷͰ "1*ΛϑϩϯτओಋͰ࡞Δ
4FSWFSMFTT'SBNFXPSL IUUQTTFSWFSMFTTDPN
ඞཁͳ"1*Λ:".-ʹॻ͖ग़͢ (&5IFMMPͱ͍͏"1*͕͜Ε͚ͩͰ࡞Ͱ͖Δ functions: hello: handler: handler.hello events: - http: path:
hello method: get cors: true
/PEFKT1ZUIPOͰϨεϙϯε͚ͩ࡞Δ DBMMCBDL ʹ+40/Λ٧ΊࠐΉ͚ͩ 'use strict'; module.exports.hello = (event, context, callback)
=> { const response = { statusCode: 200, body: JSON.stringify({ message: 'Hello World', }), }; callback(null, response); };
TUBHFΛࢦఆͯ͠σϓϩΠ ʮ͜ͷεςʔδϞοΫͱ͍ͯ͠·͢ʯͱ͔એݴ͠ͱ͘ͱ͍͍͔ # εςʔδຖʹϦιʔεΛ࡞Ͱ͖Δ $ serverless deploy —stage mock #
URLεςʔδ໊ʹԠͯ͡มΘΔ $ curl http://xyz.amazonaws.com/mock/hello-world
l z /PEFKT1ZUIPO ॻ͚Δਓʹ ιʔείʔυΛ͢
όοΫΤϯυͷ։ൃ͕ऴΘΔ·ͰϞοΫΛ͏ # ϑϩϯτͰϞοΫͷAPIΛͬͯ։ൃ͢Δ $ curl http://xyz.amazonaws.com/mock/hello-world # ։ൃ༻ͷεςʔδͰόοΫΤϯυΛ࣮͢Δ $ serverless
deploy —stage development # ࣮͞ΕͨAPI(ؔ)͔Βॱ࣍σϓϩΠ $ serverless deploy function -f hello —stage mock
l z
l z /PEFKT1ZUIPO ॻ͚Δਓʹ ιʔείʔυΛ͢
w "1*Λ͏αʔϏε։ൃͷͭΒΈ w ͳ͍"1*Λ͚ͭͩ͏Ί͍ͨ w "844FSWFSMFTT'8Ͱ࡞ΔϞοΫ"1* w ϞοΫۦಈͰϑϩϯτओಋͷ։ൃΛ ·ͱΊ