[NestJs] Api 좀 더 Restful 하게 변경
거지같던 레거시..가 아니고 내 코드를 좀더 바꿨다. (controller) import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards, Put, NotFoundException } from '@nestjs/common'; import { CorpService } from './corp.service'; import { JwtAuthGuard } from 'src/auth/auth-guard'; import { Corp } from './entities/corp.entity'; import { ApiTags, ApiOperation, ApiResponse, ApiQuery, ApiParam, ApiBody } from '@nestjs/sw..
[NestJs] Post , 생성
간단한데, 이것저것 삽질을 많이한것같다. 무튼 스프링에서 넘어가는 개발자들을 위해서 도움이 될까 한다. class-transform, class-validator, auto-mapper,Interceptor등을 살펴봤지만, 뭔가 간단하게 dto entity를 변환하는데 불필요한 기능? 좀, 의도와 다른 기능들이 보였다. 그래서 이건 나중에 적용하도록 하려고한다.(class-validator는 dto validation에 많은 도움을 줄것같다) 무튼, 시작 entity에 메소드를 추가했다(이건 jpa소스 작성 습관 같다) import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm'; import { CorpReqDto } from '../corp.re..
[NestJS] Repository Pattern
단순히 nestJS 관련 API를 개발했다. 스웨거를 붙였고, 해당 관련되서, 단순히 조회해서, 리턴하는 (DTO) 로직을 구현했다. typeorm 0.3버전 부터 좀 많이 바뀌어서, 버전은 0.2.45로 변경해서 작업을 했다. 1) 컨트롤러 import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards } from '@nestjs/common'; import { CorpService } from './corp.service'; import { JwtAuthGuard } from 'src/auth/auth-guard'; import { Corp } from './entities/corp.entity'; import { ApiTags, ApiO..