? ??? Nestjs? ????
???? ?? CRUD (??, ??, ????, ??) ??? ?????. ?????? ?? ??? TypeOrm? ???????. ??? ?? ?? ? ???? ??? ?????. ?? Cat ??? ??? ??? : Cat
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm'; @Entity() export class Cat { @PrimaryGeneratedColumn() id: number; @Column() name: string; @Column() age: number; }? ??
: ? ??> cats.controller.ts
import { Controller, Get, Post, Body, Param, Delete, Put } from '@nestjs/common'; import { CreateCatDto } from './create-cat.dto'; import { Cat } from './cat.entity'; import { CatsService } from './cats.service'; @Controller('cats') export class CatsController { constructor(private readonly catsService: CatsService) {} @Post() async create(@Body() createCatDto: CreateCatDto): Promise<Cat> { return this.catsService.create(createCatDto); } @Get() async findAll(): Promise<Cat[]> { return this.catsService.findAll(); } @Get(':id') async findOne(@Param('id') id: string): Promise<Cat> { return this.catsService.findOne(+id); } @Put(':id') async update(@Param('id') id: string, @Body() updateCatDto: CreateCatDto): Promise<Cat> { return this.catsService.update(+id, updateCatDto); } @Delete(':id') async remove(@Param('id') id: string): Promise<void> { return this.catsService.remove(+id); } }
Nestjs?? ?? CRUD ??? ????? ????????? ? ??> cats.service.ts
Nestjs?? ?? CRUD ??? ???? ??? ????? ?? ??? ?????. ? ??> ? ? ?
import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; import { Cat } from './cat.entity'; import { CreateCatDto } from './create-cat.dto'; @Injectable() export class CatsService { constructor( @InjectRepository(Cat) private catsRepository: Repository<Cat>, ) {} async create(cat: CreateCatDto): Promise<Cat> { const newCat = this.catsRepository.create(cat); return this.catsRepository.save(newCat); } async findAll(): Promise<Cat[]> { return this.catsRepository.find(); } async findOne(id: number): Promise<Cat> { return this.catsRepository.findOneBy({ id }); } async update(id: number, cat: CreateCatDto): Promise<Cat> { await this.catsRepository.update(id, cat); return this.catsRepository.findOneBy({ id }); } async remove(id: number): Promise<void> { await this.catsRepository.delete(id); } }Entity? ?????? :
?? ?? ??? ???? ?? ??? ?? (@entity). @PrimaryGeneratedColumn, @Column ?). ??? ??????? ??? ??? ?????. npm install @nestjs/typeorm typeorm
??? ?? : ormconfig.json
? ???? ???? ?? ?????? ???? ??? ?????. ?????? ??? ???? ?? ??? (????? TypeOrm?? ??)? ?????. ? ???? ??? ??? ??? ????? ????? ?? ??? ???? ??? ? ??????.
? ???? ???? HTTP ?? (??, Get, Get, Put, Delete)? ?????. ?? ??? ??? ???? ?????. Nestjs Decorators (@controller, @get, @post, @put, @delete, @body, @param)? http ??? ???? ???? ???? ? ?????.
????? (? : TypeOrm) ?? : ?????? ?????? ?? ??? ?? ?? ??? ?????. ?????? ? ??? ???? ???? ?? ?????? ??? ???? ?? ? ? ????. TypeOrm? ?? ??? ?? ? ??????? ?? ??? ???? ???? ?????.??? ?? ?? (DTOS) :
HTTP ?????? ???? ???? ????? ?? DTOS? ????. ??? ??? ????? ?? ???? ??????.- CRUD ??? ?? NestJS ?? ????? ???? ?? ??? ??????
- ? ?? ?? ??? NestJS ?? ????? ?? ?? ???? ?? ?? ??????.
- ?? ? ??? :
- ?? (? : ??? ??, ?? ??)? ???? ??? ??? ??????. ??? ?? ?? ? ??? ?? ??????. ?? ?? ?? : ???? (??? ??), ??? (???? ??) ? ????? (??? ???) ?? ?? ??? ??? ??????. ??? ?? ? ??? ???? ??????. ?? ??? ?? : ??????? ???? ?? ???? ?? ??? ?? ?? ?? ??? ?????? ???? ??? ??? ??????. ?? ?? :
- ??? ?? ?? ????? ???? ??? HTTP ??? ?????. ??. ??? : ??? ???? ???? ???? ?? ?? ? ?? ???? ??????. versioning :
- ??? ?? API? ?? ??? ???? ?? API ??? ???? ?? ??????. ??? ???? ??? ????? : ?? ??? ?? ??? : ??? ??? ???? ??? ?? ??? (? : SQL ??) ? ??? ???? ??? ? ????. ?? ??? ?????. ?? ??? ? ??? ???? ???? ?? ???? ?????.
????? ???? ?? ?? : - ????? ?? ?????? ??? : ????? ??????? ?? ?? ????? ????. ?? ??? ? ??? ??? ??????. ???? ??? ???? : ????? ????? ??????. ?? ??? ????? ?? ???? ?????? ?????.
- ??? ?? : ???? ????? ??? ??? ??? ? ????. ???? ? ?????? ?? ??? ? ?? ???? ?? ?? ???? ??????. Pagination ? ??? ?? : ?? ??? ??? ?? Pagination ? ???? ???? ?? ? ??? ??? ??????. ?? ??? ???? ?? ??? ??? ???? ????
? ??? Nestjs Crud ?? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

Node.js?? HTTP ??? ???? ? ?? ???? ??? ????. 1. ?? ????? ????? ??? ??? ? ?? ????? ?? ?? ? https.get () ??? ?? ??? ??? ? ?? ????? ?? ??? ?????. 2.axios? ??? ???? ? ?? ??????. ??? ??? ??? ??? ??? ??? ???/???, ?? JSON ??, ???? ?? ?????. ??? ?? ??? ????? ?? ????. 3. ?? ??? ??? ??? ??? ???? ???? ??? ??? ???? ?????.

JavaScript ??? ??? ?? ?? ? ?? ???? ????. ?? ???? ???, ??, ??, ?, ???? ?? ? ??? ?????. ?? ????? ?? ?? ? ? ??? ????? ?? ??? ??? ????. ??, ?? ? ??? ?? ?? ??? ??? ??? ???? ??? ??? ???? ??? ?? ??? ????. ?? ? ????? ??? ???? ? ??? ? ??? TypeofNull? ??? ?????? ??? ? ????. ? ? ?? ??? ???? ?????? ????? ???? ??? ???? ? ??? ? ? ????.

?? JavaScript ??? ??? ??? ?????? ?? ??? ?? ?? ??? ?? ???? ????. 1. ??? ???? ???? ?? ??? ?? ? ? ???? ??? ??? ?? ? ?? ????? ?????. 2. Angular? ?????? ??? ?? ???? ? ?? ?? ??? ??? ??? ???? ?????. 3. VUE? ???? ?? ??? ???? ?? ?? ??? ?????. ?? ?? ?? ??, ? ??, ???? ???? ? SSR? ???? ??? ??? ??? ???? ? ??? ?????. ???, ??? ??? ??? ????? ????. ??? ??? ??? ??? ?? ????.

?????, JavaScript ???! ?? ? JavaScript ??? ?? ?? ?????! ?? ?? ??? ??? ??? ? ????. Deno?? Oracle? ?? ??, ??? JavaScript ?? ??? ????, Google Chrome ???? ? ??? ??? ???? ?????. ?????! Deno Oracle? "JavaScript"??? ????? Oracle? ?? ??? ??? ??????. Node.js? Deno? ??? ? Ryan Dahl? ??? ?????? ???? ????? JavaScript? ??? ???? Oracle? ????? ???? ?????.

??? JavaScript?? ??? ??? ?????? ?? ???????. ?? ??, ?? ?? ? ??? ??? ?? ????? ????? ?????. 1. ?? ??? ??? ????? ???? ??. ()? ?? ??? ??? ?????. ?. ()? ?? ??? ?? ??? ??? ?? ? ? ????. 2. ?? ??? .catch ()? ???? ?? ??? ??? ?? ??? ??????, ??? ???? ???? ????? ??? ? ????. 3. Promise.all ()? ?? ????? (?? ?? ?? ? ??????? ??), Promise.Race () (? ?? ??? ?? ?) ? Promise.AllSettled () (?? ??? ???? ??)

Cacheapi? ?????? ?? ???? ??? ???? ???, ?? ??? ??? ?? ???? ? ??? ?? ? ???? ??? ??????. 1. ???? ????, ??? ??, ?? ?? ?? ???? ???? ??? ? ????. 2. ??? ?? ?? ??? ?? ? ? ????. 3. ?? ?? ?? ?? ?? ??? ??? ?? ?????. 4. ??? ???? ?? ?? ???? ?? ?? ?? ?? ?? ???? ?? ?? ??? ??? ? ????. 5. ?? ???? ??, ??? ??? ? ??? ??, ?? ??? ? ?? ???? ???? ???? ? ?? ?????. 6.?? ??? ?? ?? ?? ??, ???? ?? ? HTTP ?? ????? ?????? ???????.

.map (), .filter () ? .reduce ()? ?? JavaScript ?? ?? ???? ??? ??? ??? ? ? ????. 1) .map ()? ??? ??? ??? ???? ? ??? ???? ? ?????. 2) .filter ()? ???? ??? ????? ? ?????. 3) .reduce ()? ???? ?? ??? ???? ? ?????. ???? ??? ????? ??? ?? ?? ??? ?????.

JavaScript? ??? ??? ?? ??, ? ? ? ?? ???? ???? ??? ??? ?????. 1. ?? ??? ?? ??? ???? ??? ??? ??? ??? ?? WebAPI? ?????. 2. WebAPI? ??????? ??? ?? ? ? ??? ?? ??? (??? ?? ?? ???? ??)? ????. 3. ??? ??? ?? ??? ?? ??? ?????. ?? ??? ??? ????? ??? ??? ?? ? ???? ?????. 4. ???? ?? (? : Promise. 5. ??? ??? ???? ?? ???? ???? ?? ?? ?? ??? ????? ? ??????.
