Modern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdf
Modern DevOps Day 2.pdfModern DevOps Day 2.pdfModern DevOps Day 2.pdfModern DevOps Day 2.pdfModern DevOps Day 2.pdfModern DevOps Day 2.pdfModern DevOps Day 2.pdfModern DevOps Day 2.pdfModern DevOps Day 2.pdf
9 logging and monitoring.pdf 9 logging and monitoring.pdfNuttavutThongjor1
Babel Coder is a tool that provides access to the Elastic Stack and Grafana. It mentions Babel Coder and its integration with the Elastic Stack and Grafana in a repetitive manner without providing many details about the product, its features, or benefits.
More Related Content
Similar to Fullstack Nest.js and Next.js.pdfFullstack Nest.js and Next.js.pdfFullstack Nest.js and Next.js.pdf (18)
Modern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdfModern DevOps Day 4.pdf
Modern DevOps Day 2.pdfModern DevOps Day 2.pdfModern DevOps Day 2.pdfModern DevOps Day 2.pdfModern DevOps Day 2.pdfModern DevOps Day 2.pdfModern DevOps Day 2.pdfModern DevOps Day 2.pdfModern DevOps Day 2.pdf
9 logging and monitoring.pdf 9 logging and monitoring.pdfNuttavutThongjor1
Babel Coder is a tool that provides access to the Elastic Stack and Grafana. It mentions Babel Coder and its integration with the Elastic Stack and Grafana in a repetitive manner without providing many details about the product, its features, or benefits.
The document discusses Kubernetes concepts including pods, deployments, services, and configmaps. It shows examples of running pods and deployments. It also demonstrates different service types like ClusterIP, NodePort, and LoadBalancer and how to access applications using services. Finally, it provides an example of creating a configmap from a file and referencing it in a deployment.
This document provides an overview of Angular fundamentals including components, directives, pipes, services, and reactive programming concepts. It defines components as reusable UI building blocks that control a view. It demonstrates core directives like NgFor, NgIf, and NgSwitch. It also covers lifecycle hooks, built-in and custom pipes, dependency injection with services, RxJS observables, and reactive programming concepts like streams and operators.
The document discusses different approaches to organizing code for a MEAN stack application, including using multiple repositories, a monorepository, or an NX workspace. It also covers component-based and feature-based approaches to code organization, with the component-based approach grouping related UI components together and the feature-based approach grouping code for an feature together, such as all code related to retrieving articles from an API.
This document discusses state management tools for JavaScript applications. It mentions Babel Coder, PINIA, and multiple stores for state including store, store, store, ui, user, and conf.
This document discusses different rendering modes for Babel Coder including client-side rendering, server-side rendering, and prerendering. It mentions APIs for client-side and server-side rendering and examples of URLs and files involved in prerendering and the stale-while-revalidate approach.
5. Babel Coder
Babel Coder
https://www.babelcoder.com
RESTFUL API
C 1 C 2 C 2 C 2
RESTful API คือเว็บเซอร์วิสรูปแบบหนึ่งที่กำหนดให้ API ประกอบด้วยทรัพยากรที่ Client สามารถร้องขอเพื่อเข้าถึงได้ โดย
Client จะทำการระบุทรัพยากรที่ต้องการเข้าถึงผ่าน URL และระบุการดำเนินการผ่าน HTTP Method
/products
Product
Order
User
Comment
URL
Method GET
เมื่อ API ประมวลผลเสร็จสิ้นจะคืนผลลัพธ์กลับมาในฟอร์แมตต่าง ๆ เช่น JSON เพื่อให้ Client ทราบว่าผลลัพธ์การทำงานเป็นเช่น
ไร API ต้องส่ง HTTP Status Code กลับด้วย พร้อมระบุ MIME Type เพื่อบอกชนิดของข้อมูลที่ส่งกลับ
MIME Type
Status
Response
application/json
200 OK
6. Babel Coder
Babel Coder
https://www.babelcoder.com
HTTP
Method
URL ความหมาย Status เมื่อสำเร็จ Status เมื่อไม่สำเร็จ
GET /products ร้องขอข้อมูล Products ทั้งหมด 200 OK
GET /products/1 ร้องขอข้อมูล Product ที่มี ID เป็น 1 200 OK 404 NOT FOUND
POST /products สร้างข้อมูล Product ตัวใหม่ 201 CREATED
400 BAD REQUEST
422 UNPROCESSIBLE ENTITY
PATCH /products/1 อัพเดทข้อมูลบางส่วนของ Product ที่มี ID เป็น 1 200 OK
400 BAD REQUEST
422 UNPROCESSIBLE ENTITY
DELETE /products/1 ลบข้อมูลของ Product ที่มี ID เป็น 1
200 OK
204 NO CONTENT
404 NOT FOUND
RESTFUL API
11. Babel Coder
Babel Coder
https://www.babelcoder.com
imports
Products
Products Controller Products Service
injec
t
UsersModul
e
providers ProductsService
imports
Auth
Auth Controller Auth Service
inject
UsersModule
providers AuthService
exports AuthService
@Global()
MODULES
Users Controller Users Service
providers
exports
Users
inject
UsersService
UsersService
inject
Global Modules สามารถใช้งานได้เลยโดยไม่ต้อง
ทำการระบุในส่วนของ imports
controllers UsersController
controllers AuthController
controllers ProductsController
12. Babel Coder
Babel Coder
https://www.babelcoder.com
SETTING UP
$ npx @nestjs/cli new
api
Which package manager would you ❤️ to use? pnpm
ทำการสร้างโปรเจคชื่อ api ผ่าน Nest CLI โดย
เลือกใช้ Package Manager เป็น pnpm
api
nest-cli.json
src
app.controller.ts
app.module.ts
app.service.ts
main.ts
App Module
ไฟล์การทำงานหลัก สามารถตั้งค่าการทำงานแบบ Global ได้ในไฟล์นี้
ไฟล์ตั้งค่าการทำงานของ Nest CLI
58. Babel Coder
Babel Coder
https://www.babelcoder.com
DATABASE MIGRATION
development qa production
name
User
age
gender
name
User
age
name
User
Database Migration คือกระบวนการจัดโครงสร้างและข้อมูลของฐานข้อมูลปลายทางเพื่อให้มีผลลัพธ์เป็นไป
ตามที่ต้องการโดยอาศัย Script ที่รวมชุดคำสั่งในการแก้ไขเปลี่ยนแปลงนั้น ๆ
59. Babel Coder
Babel Coder
https://www.babelcoder.com
DATABASE MIGRATION
development qa production
name
User
age
gender
หากยังไม่เคยนำส่ง Migration scripts ไปยัง Environment อื่นมาก่อน เมื่อเสร็จสิ้นกระบวนการพัฒนาและพร้อมที่จะ
นำส่งไปยัง Environment อื่น ให้ทำการสร้าง Migration แรกขึ้นมาก่อนที่จะทำการนำส่งสู่ Environment อื่นต่อไป
$ npx prisma migrate dev --name init
api
prisma
migrations
20240613163955_init
migration.sql
60. Babel Coder
Babel Coder
https://www.babelcoder.com
npx prisma migrate deploy
MIGRATION DEPLOYMENT
development qa production
name
User
age
gender
เมื่อทำการ Deploy โค้ดไปยัง Environment อื่นแล้ว เพื่อให้ฐานข้อมูลของ Environment ปลายทางมีโครงสร้างและ
ข้อมูลเป็นไปตาม Migration scripts ให้ทำการใช้คำสั่ง npx prisma migrate deploy
$
name
User
age
gender
61. Babel Coder
Babel Coder
https://www.babelcoder.com
DATABASE MIGRATION
development qa production
fullname
User
age
gender
หากมีการสร้าง Migration scripts ขึ้นมาแล้วครั้งหนึ่ง การเปลี่ยนแปลงข้อมูลหรือ Model ใน schema.prisma ใด ๆ
จะต้องทำการสร้าง Migration scripts ที่สอดคล้องขึ้นมาใหม่เสมอ ๆ
$ npx prisma migrate dev --name changed_name_to_fullname_in_users