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
AmplifyとNext.jsとNest.js
Search
yosi
August 08, 2022
Programming
0
520
AmplifyとNext.jsとNest.js
yosi
August 08, 2022
Tweet
Share
More Decks by yosi
See All by yosi
自社開発のエンジニアの私が 大事にしてること(n=1)
yoshisan
1
43
なるほどGit講座 (追跡ブランチが理解できます!)
yoshisan
0
160
「自分の時間を生きる」キャリア論
yoshisan
1
93
小学生でもわかる SlackAPI×GAS
yoshisan
0
100
達人プログラマーになろう!
yoshisan
0
110
認証認可
yoshisan
1
120
オブジェクト指向が"チョットワカル"スライド
yoshisan
0
110
Linuxについて"ほんのチョットワカル"スライド
yoshisan
1
95
Let's React!! "チョットワカル"の第一歩
yoshisan
1
170
Other Decks in Programming
See All in Programming
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
330
CSC509 Lecture 14
javiergs
PRO
0
140
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
110
Jakarta EE meets AI
ivargrimstad
0
230
42 best practices for Symfony, a decade later
tucksaun
1
180
あれやってみてー駆動から成長を加速させる / areyattemite-driven
nashiusagi
1
200
Criando Commits Incríveis no Git
marcelgsantos
2
170
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
360
tidymodelsによるtidyな生存時間解析 / Japan.R2024
dropout009
1
760
103 Early Hints
sugi_0000
1
220
Full stack testing :: basic to basic
up1
1
930
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.6k
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
95
5.2k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
4 Signs Your Business is Dying
shpigford
181
21k
Code Reviewing Like a Champion
maltzj
520
39k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
How to Ace a Technical Interview
jacobian
276
23k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
97
A designer walks into a library…
pauljervisheath
204
24k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Transcript
Amplify Next.js Nest.js ͞ΘͬͯΈͨʂ
ࠓճ࣮ࡍʹ͞ΘͬͯΈͯ,,, • ͱͬͯૉૣ͘ىಈͰ͖Δʂ(ίϚϯυୟ͚ଈʂ) • Ͱɺ࣮ݱͰ͖Δ·ͰʹͪΐͬͱϋϚͬͨͱ͜Ζ͋Γ • ࠓճAmplifyͰNext.jsΛσϓϩΠͱNest.jsͰCRUDͷ2ͭΓ·ͨ͠ʂ
֤ϑϨʔϜϫʔΫʹ͍ͭͯ Amplify • SPA੩తδΣωϨʔλʔΛ࠷ͰϦϦʔε͢ΔͨΊʹ։ൃϓϥοτϑΥʔϜ AmplifyϑΝϛϦʔ • Framework ɹˠΫϥΠΞϯτ͕AWSͷόοΫΤϯυͱ࿈ܞ͢ΔͨΊͷॲཧΛߦͰ࣮Ͱ͖ΔΑ͏ʹ ͢ΔϑϨʔϜϫʔΫͰ •
CLI ɹˠAWSͰαʔόʔϨεͳόοΫΤϯυΛߏஙɾཧ͢ΔͨΊͷCLIπʔϧɻ • Developer Tools ɹˠϑϩϯτΤϯυͱόοΫΤϯυʹରͯ͠ϏϧυɺςετɺσϓϩΠɺϗεςΟϯάΛ ༰қʹ࣮ݱͰ͖ΔAWSαʔϏε
֤ϑϨʔϜϫʔΫʹ͍ͭͯ Next.js • ΞϓϦ͚ʔγϣϯߏஙΊͬͪΌ؆୯ $ npx create-next-app (Reactcreate-react-app ͋Δ͕,,,)
• ϧʔςΟϯά͕༰қ • SPAͱSSRͷͷΓସ͕͑؆୯ Next.js࠾༻اۀ Hulu Uber NETFLIX Github,docer
֤ϑϨʔϜϫʔΫʹ͍ͭͯ Nest.js • TSΛϕʔεͱͨ͠όοΫΤϯυ • ݟͨײ͡SpringBootͱࣅͯΔͱ͜Ζଟ͠ʂ(↓) • Controller,Service,ModuleͷࡾͰͦΕͧΕ͕͋Δɻ(͔Γ͍͢) • ֤ࡾίϚϯυͰ࡞Δ
$ nest g module userModule
ϋϚͬͬͨͱ͜ Amplify×Next.jsʹ͍ͭͯ • AmplifyΛ͏ͷʹҎԼͷྲྀΕͰͬͯΈͨ 1.AWS CLIͷΠϯετʔϧ →aws con
f igure Ͱpro f ileΛઃఆ 2.Amplify CLIͷΠϯετʔϧ →ΠϯετʔϧʹNode͕ඞཁʂ 3.Next.jsͰϓϩδΣΫτ࡞ͬͯ amplify init Λ͢Δɻ 4.Next.jsͷίʔυΛGitHubʹ͋͛Δ 5Amplify͔ΒGUIͰσϓϩΠ
ϋϚͬͬͨͱ͜ Amplify×Next.jsʹ͍ͭͯ • AmplifyΛ͏ͷʹҎԼͷྲྀΕͰͬͯΈͨ 1.AWS CLIͷΠϯετʔϧ →aws con
f igure Ͱpro f ileΛઃఆ 2.Amplify CLIͷΠϯετʔϧ →ΠϯετʔϧʹNode͕ඞཁʂ 3.Next.jsͰϓϩδΣΫτ࡞ͬͯ amplify init Λ͢Δɻ 4.Next.jsͷίʔυΛGitHubʹ͋͛Δ 5Amplify͔ΒGUIͰσϓϩΠ ͍ɺ͜͜ͰҾֻ͔ͬΓ·ͨ͠ɻ Nodeͷόʔδϣϯʹʂ
ϋϚͬͬͨͱ͜ Nest.js×Amplify • ͲͪΒΛμϯϩʔυ͢ΔʹNode͕ඞཁɻɹɹݱࡏnode ver 12.9.0 • ͔͠͠Next.jsΛcreate͢Δࡍʹ͜ΜͳΤϥʔ
• ;Ή;Ήɺnode͋͛ͨΒ͍͍ΜͶʂ →͕ɺ͔͠͠ઌ΄ͲΠϯετʔϧͨ͠Amplifynode12.9.0ͰΠϯετʔϧ ͔ͨ͠ΒAmplify init͕Ͱ͖ΜΜΜΜʂʂʂʂʂ
ϋϚͬͬͨͱ͜ Nest.js×Amplify • • ࠓճglobalʹ12.9.0Λࢦఆ͕ͯͨ͠ɺassistanceʹlocal12.9.0Λࢦఆ globalʹݱࡏnodeਪதͷ14.17.4Λઃఆ
→ͪΖΜશͯҰΞϯΠϯετʔϧͯ͠࠶μϯϩʔυͨ͠Α(ͽ͑Μ) ͜Μͳ࣌ nodoenv ΛͬͯόʔδϣϯΛΓସ͑Α͏ʂ
Nest.js Controller • Controller • SpringBootͱ΄΅ಉ͡ • @ControllerͷΑ͏ʹΞϊ ςʔγϣϯΛͬͯΔ෦ͳ
ͲΘ͔Γ͍͢ →AngularௐͯΈ͕ͨ ΞϊςʔγϣϯΛͬͨهड़ ͕͋ΔɻΓAngularΛࢀ ߟʹͯ͠Δ͚ͩ͋Δ
Nest.js Service • Controller • جຊతʹॲཧͷ۩ମ͜͜ɻ • @InjectableͳͲDI(ґଘੑͷ ೖ)χϠͬͯ͠·ͨ͠স
• ֤ϝιουΛ͜Ͷ͜Ͷɻ
Nest.js Module • app.module •
User.module • ͜͜DBͱcontrollerͱserviceΛ͍͍ײ͡ʹܨ͙Πϝʔδ
·ͱΊ ɾNestͱNextΛAmplifyͳͰࡌͤ Δ͜ͱ͕Ͱ͖ͳ͔ͬͨͷͰɺͦ͜ ·ͰͬͯΈ͔ͨͬͨɻ ɾϋϚΔͱ͜Ζ͕͋ͬͨ࠶ ͬͯΈΔͱૣ͍ૣ͍ʂ ɾ·ͩ·ͩศརͳ෦ɺ͍ʹ͘ ͍෦Λ୳͍͖ͯͨ͠͠ʂ
ޚਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ Ҿ༻ Next.jsɺAmplifyͰ։ൃڥߏங͢Δ(https://qiita.com/ps-y-uehara/items/4542349252eb3d83e644) NestJSೖɹجૅ͔ΒMomgoDBɺೝূ·ͰΛҰؾʹղઆ ( https://www.youtube.com/watch?v=HQ3tjl_Sh9s )