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
ぜひ使って欲しいCloud Functions for Firebase
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
DaikiOKA
August 21, 2019
Programming
300
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ぜひ使って欲しいCloud Functions for Firebase
DaikiOKA
August 21, 2019
More Decks by DaikiOKA
See All by DaikiOKA
スマホアプリのアナリティクス最適解
daikioka
0
220
Firestoreを利用したMAPアプリの開発について
daikioka
0
300
位置情報を利用したMAPアプリの開発
daikioka
0
300
nori-na Tech Night vol.3
daikioka
0
330
相乗りアプリを構想から1ヶ月でストアにリリースできたわけ
daikioka
0
260
nori-na_tech_night_vol2.pdf
daikioka
0
570
Other Decks in Programming
See All in Programming
the container ship “Apple Silicon”@WWDC26 Recap -Japan-\(region).swift
shingangan
0
120
Android CLI
fornewid
0
220
Foundation Models frameworkで画像分析
ryodeveloper
1
610
メールのエイリアス機能を履き違えない
isshinfunada
0
230
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
150
Go 1.27 における memory allocation の高速化
andpad
0
150
自動化したのに回らない テスト運用の壁―AI時代の品質責任と生産性
mfunaki
0
140
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
250
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
220
React本体のコードリーディング
high_g_engineer
1
140
「人を評価する AI」の設計と実装
ryoyanara
0
190
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.7k
Featured
See All Featured
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
700
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.3k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
330
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Evolving SEO for Evolving Search Engines
ryanjones
0
250
Building Flexible Design Systems
yeseniaperezcruz
330
40k
How to Think Like a Performance Engineer
csswizardry
28
2.7k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
1.1k
Documentation Writing (for coders)
carmenintech
77
5.4k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Transcript
ͥͻͬͯཉ͍͠ Cloud functions for Firebase
Cloud functions for firebaseͱ 'JSFCBTFͷϢʔβೝূɺσʔλϕʔεͷՃͳͲͷΠϕϯτ Λड͚औͬͯॲཧΛߦ͏αʔϏε ରԠݴޠɿ+BWB4DSJQUPS5ZQF4DSJQU 'JSFTUPSFτϦΨʔ w PO$SFBUF
w PO6QEBUF w PO%FMFUF w PO8SJUF
nori-naͰͷར༻ํ๏ • ϓογϡ௨ • σʔλͷूܭ • ֎෦αʔϏεͱͷ࿈ܞ(ܾࡁɺݕࡧ)
ϓογϡ௨ onCreate export const pushRideshareRequest = functions.firestore .document(commonUtil.makePath('ridesharerequest/{requestId}')) .onCreate((snap, context)
=> { const newValue = new firestoreModels.RideShareRequest(snap.data()); const to = newValue.to; console.log(`push start ridesharerequest : ${context.params.requestId}`); return pushMessageByUserId(to, '૬Γґཔ͕ಧ͖·ͨ͠ɻ༰Λ֬ೝͯ͠ڐՄ͠·͠ΐ͏ɻ'); });
ϓογϡ௨ onUpdate export const pushLikeComment = functions.firestore .document(commonUtil.makePath('mapcomment/{mapcommentId}')) .onUpdate((change, context)
=> { const afterData = new firestoreModels.MapComment(change.after.data()); const afterLike = afterData.likeMembers.length; const beforeData = new firestoreModels.MapComment(change.before.data()); const beforeLike = beforeData.likeMembers.length; const toUserId = afterData.user; if (!toUserId) return null; if (beforeLike < afterLike) { return pushMessageByUserId(toUserId, '͍͍Ͷ͕ԡ͞Ε·ͨ͠ʂ'); } return null; });
ϩʔΧϧͰςετՄೳ $npm run shell
ςετίʔυ QVTI%FTUJOBUJPO6QEBUF \ CFGPSF\ TDSFFO/BNFVTF MPDBUJPO\ MBUJUVEF
MPOHJUVEF ^ EFTUJOBUJPO\ OBNF5 HFP-PDBUJPO\ MBUJUVEF MPOHJUVEF ^ ^ ^ BGUFS\ TDSFFO/BNFVTFS MPDBUJPO\ MBUJUVEF MPOHJUVEF ^ EFTUJOBUJPO\ OBNF5PLZP5PXFS HFP-PDBUJPO\ MBUJUVEF MPOHJUVEF ^ ^ ^ ^ \ QBSBNT\ VTFS*EVTFS ^ ^ • beforeͱafterʹͦΕͧ ΕσʔλΛهड़ • paramsඞཁͳ࣌ͷ Έ
Cloud Functionͷ৽ػೳ Scheduler export const cronRemindShare = functions.pubsub //.schedule("0 18
* * *")//ຖ18࣌ʹ࣮ߦ .schedule("every 5 minutes")//͓͖̑ .timeZone("Asia/Tokyo") .onRun(async context => { console.log("͜͜Ͱఆظ࣮ߦ") });
͋Γ͕ͱ͏͍͟͝·ͨ͠
OPSJOB 5FDI /JHIU