무료
다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결따라하며 배우는 NestJS
auth 컨트롤러 파일에서 signUp은 ": Promise<~>"를 붙이는데 signIn은 왜 안 붙이시나요?
auth 컨트롤러 파일에서 signUp은 ": Promise<~>"를 붙이는데 signIn은 왜 안 붙이시나요?" : Promise<string> "를 붙여줘야 하는 거 아닌가요?
- 미해결따라하며 배우는 NestJS
createBoard() 완성과 주입후 POST요청 오류 문제입니다!
createBoard()를 controller에 주입한 후 postman을 통해 post요청을 보내는 부분인데요. 그림과 같이 title과 description이 undefined로 나오고 있습니다.자세한 코드는 아래에 저장소 링크로 첨부하도록 하겠습니다.https://github.com/peanutyumyum/nest-study
- 미해결따라하며 배우는 NestJS
구현 완료 후 not a function 오류
구현완료후 postman에서 localhost:3000/auth/signup 에 post 했더니 this.userRepository.createUser is not a function이라는 에러가 납니다. 정확히 모두 따라했는데 왜 에러가 나는지 모르겠습니다.
- 미해결따라하며 배우는 NestJS
@UseGuards(AuthGuard()) 를 사용하지않고
@UseGuards(AuthGuard()) 를 사용하지않고 Passport jwt 전략을 사용할 순 없나요?영상에서 @UseGuards(AuthGuard()) 등록 전 api request를 하셨는데 그때도 passport를 거쳐간건지 궁금합니다.
- 미해결따라하며 배우는 NestJS
async await 관련 질문입니다.
좋은 강의 영상 감사합니다. controller에서 service함수를 이용할때에는 async await 를 안써줘도 괜찮나요? 괜찮은것 같은데 혹시 그 이유는 무엇일까요..?
- 미해결따라하며 배우는 NestJS
강의자료 다운로드 관련
안녕하세요! 강의 잘 듣고 있는 수강생입니다.강의자료 다운 받으면 pdf, xml 모두 폴더가 비어 있습니다.(DS_store 파일만 있어서요..)혹시 제가 모르는 부분이 있으면 알려주시면 감사하겠습니다!
- 미해결따라하며 배우는 NestJS
뒷 부분 공부하고 싶습니다!
강의 뒷 부분이 너무 궁금합니다!다른 비슷한 질문에 올라온 답변의 url은 다른 사람은 못 보게 돼 있는 것 같습니다.. 자료를 따로 받을 순 없는건가요??
- 미해결따라하며 배우는 NestJS
update를 repository로 빼서 작성했는데 오류가 나옵니다
boards.service.ts 코드입니다.import { Injectable, NotFoundException } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { BoardStatus } from './board-status.enum'; import { Board } from './board.entity'; import { BoardRepository } from './board.repository'; import { CreateBoardDto } from './dto/create-board.dto'; @Injectable() export class BoardsService { constructor( @InjectRepository(Board) private boardRepository: BoardRepository, ) {} createBoard(createBoardDto: CreateBoardDto): Promise<Board> { return this.boardRepository.createBoard(createBoardDto); } async getBoardById(id: number): Promise<Board> { console.log(id, 'ididid'); return this.boardRepository.getBoardById(id); } async deleteBoard(id: number): Promise<void> { const result = await this.boardRepository.delete(id); if (result.affected == 0) { throw new NotFoundException(`Can't find Board with id ${id}`); } } async updateBoardStatus(id: number, status: BoardStatus): Promise<Board> { const board = await this.getBoardById(id); board.status = status; await this.boardRepository.save(board); return board; } } board.repository.ts 코드입니다import { Injectable, NotFoundException } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { BoardStatus } from './board-status.enum'; import { Board } from './board.entity'; import { BoardRepository } from './board.repository'; import { CreateBoardDto } from './dto/create-board.dto'; @Injectable() export class BoardsService { constructor( @InjectRepository(Board) private boardRepository: BoardRepository, ) {} createBoard(createBoardDto: CreateBoardDto): Promise<Board> { return this.boardRepository.createBoard(createBoardDto); } async getBoardById(id: number): Promise<Board> { console.log(id, 'ididid'); return this.boardRepository.getBoardById(id); } async deleteBoard(id: number): Promise<void> { const result = await this.boardRepository.delete(id); if (result.affected == 0) { throw new NotFoundException(`Can't find Board with id ${id}`); } } async updateBoardStatus(id: number, status: BoardStatus): Promise<Board> { const board = await this.getBoardById(id); board.status = status; await this.boardRepository.save(board); return board; } } [Nest] 12296 - 2023. 01. 26. 오후 4:25:43 ERROR [ExceptionsHandler] this.boardRepository.getBoardById is not a functionTypeError: this.boardRepository.getBoardById is not a function at BoardsService.getBoardById (C:\Users\lgh38\Desktop\GH\nest-board-app\src\boards\boards.service.ts:22:33) at BoardsService.updateBoardStatus (C:\Users\lgh38\Desktop\GH\nest-board-app\src\boards\boards.service.ts:33:30) at BoardsController.updateBoardStatus (C:\Users\lgh38\Desktop\GH\nest-board-app\src\boards\boards.controller.ts:44:31)오류 내용은 위와 같습니다. 자세히 보면 this.boardRepository.getBoardById is not a function이라고 나오는데 제가 생각 했을 땐 처음 service의 updateBoardStatus 함수에서 getBoardById 함수로 넘겨주고 또 getBoardById 함수가 repository 안에 있는 getBoardById 함수에게 값을 넘겨서 두 번 리턴 받아서 해결 될 줄 알았는데 에러가 나오더라구요..오히려 분리를 안 시켰을 땐 오류가 안 나옵니다 무슨 이유일까요..?
- 미해결따라하며 배우는 NestJS
findOne() undefined 이유 아시는분
async validate(payload) { const { username } = payload; console.log(username); console.log(payload); const user: User = await this.userRepository.findOne(username); if (!user) { throw new UnauthorizedException('error'); } return user; } }logleejinleejinseong{ username: 'leejinleejinseong', iat: 1674638178, exp: 1674641778 }위 로그처럼 데이터는 로그에 찍히는데 왜 findOne에서 undefined 나올까요? 이유 아시는분..2시간 박치기하고있습니다..덜덜;;; 별짓 다해봐도 해결이 안되네요;;
- 미해결따라하며 배우는 NestJS
회원가입 기능 구현
#7-2 회원가입 기능구현에서 강의 내용 전체 작성 후 회원가입 진행하였는데, username과 password가 컨트롤러에서 console.log(authCredentialDto)를 찍으니 빈 객체만 내뱉고 있고 db에 정상적으로 저장이 되지 않았습니다. 이리저리 코드를 수정해보니.dto 구성 단게에서 validator import 후에 정상적으로 출력이 됩니다. 강의 영상에서는 문제 없이 되던데 왜 이렇게 되는지 궁금합니다.
- 미해결따라하며 배우는 NestJS
nest js cli가 클라이언트 약자가 아니라 command line interface의 약자 아닌가요?
#1 4 강의를 듣고 있는데 클라이언트라고 (0:17 ~ 0:26)말씀하셨는데, CLI가 command line interface의 약자인거 같아서요~확인 부탁 드립니다! 감사합니다.
- 미해결따라하며 배우는 NestJS
구현 완료 후 TypeError: this.userRepository.createUser is not a function
TypeError: this.userRepository.createUser is not a function포스트맨에서 localhost:3000/auth/signup실행시 서버가 터지며ㅑㄴ서TypeError: this.userRepository.createUser is not a function이런 에러를 내보내고 있는데, 아무리봐도 코드는 모두 똑같아서 무슨 문제인지 찾아지지가 않네요ㅠ
- 미해결따라하며 배우는 NestJS
강의 잘들었습니다! 배포 자료 받을수있을까요?
안녕하세요. 강의 잘들었습니다. 감사합니다.그런데 마지막에보여주신 배포관련 pdf 볼수있을까요? 다른분이 질문해주신 답글https://drive.google.com/file/d/1z3QUaECsZ_bVHIUF-rYyDrNv_oCvR8re/view?usp=sharing여기에는 한장의 사진만 보여서요!
- 미해결따라하며 배우는 NestJS
board controller에서 board.model이 module이 아니라는 에러가 발생합니다.
안녕하세요! ts, node 자체가 처음이라 너무 사소한 질문이 아닐지 걱정이 되지만, 해결이 안되어 여쭤봅니다 ㅠㅠboard.model.ts 작성 후, controller에서 에러가 발생합니다.board.model.ts가 왜 모듈이 안됐을까요? 강의를 정말 다 따라하고 pdf파일도 몇번 확인해보고 깃에서도 확인해보았는데 저 에러가 없어지지 않네요 ㅠㅠsrc/boards/boards.controller.ts:2:23 - error TS2306: File '/Users/jeongsoi/project/maumlab/src/boards/board.model.ts' is not a module. 2 import { Board } from './board.model'; ~~~~~~~~~~~~~~~ src/boards/boards.service.ts:2:36 - error TS2306: File '/Users/jeongsoi/project/maumlab/src/boards/board.model.ts' is not a module. 2 import { Board, BoardStatus } from './board.model';
- 미해결따라하며 배우는 NestJS
BoardsService에 getAllBoards property가 없다고 나옵니다
안녕하세요! 좋은 강의 무료로 제공해주셔서 정말 감사합니다!다름이 아니라 강의 초반 board api 작성중인데요! 강의와 똑같이 board controller에서 boardService DI하고 getAllBoards, createBoard 메서드를 불러왔는데, 아래와 같은 에러가 발생합니다어떻게 처리하면 될지 알려주시면 정말 감사드리겠습니다!boards.service.tsboards.controller.ts Error logsrc/boards/boards.controller.ts:2:23 - error TS2306: File '/Users/jeongsoi/project/maumlab/src/boards/board.model.ts' is not a module. 2 import { Board } from './board.model'; ~~~~~~~~~~~~~~~ src/boards/boards.controller.ts:15:35 - error TS2339: Property 'getAllBoards' does not exist on type 'BoardsService'. 15 return this.boardsService.getAllBoards(); ~~~~~~~~~~~~ src/boards/boards.controller.ts:22:35 - error TS2339: Property 'createBoard' does not exist on type 'BoardsService'. 22 return this.boardsService.createBoard(title, description);
- 미해결따라하며 배우는 NestJS
[JWT를 이용해서 토큰 생성하기] secretOrPrivateKey must have a value 에러 발생
JWT를 이용해서 토큰 생성하기 강의중POST /sigin API에 요청을 보냈을 때 아래와 같은 에러가 발생합니다:ERROR [ExceptionsHandler] secretOrPrivatekey must have a value
- 미해결따라하며 배우는 NestJS
npm run start시 QueryFailedError: "username" 열의 자료 가운데 null 값이 있습니다. 에러가 발생합니다.
npm run start로 application을 실행시켰을 때QueryFailedError: "username" 열(해당 릴레이션 "user")의 자료 가운데 null 값이 있습니다에러가 발생합니다.DB 상태는 회원가입한 유저가 user 테이블에 존재합니다.
- 미해결따라하며 배우는 NestJS
typeorm 0.3.x 버전 오류
많은 분들이 남겨준 것처럼 typeorm 0.3.x 버전 오류로 인해 저도 조금 고생했습니다.공식문서 참조하며 해결했습니다.https://docs.nestjs.com/techniques/database#repository-patterntypeorm 0.3.x 버전은 @EntityRepository 가 deprecated 됐기 때문에 custom Repository를 생성해주었습니다. custom Repository 생성은 아래 블로그를 참조했습니다.https://velog.io/@pk3669/typeorm-0.3.x-EntityRepository-%EB%8F%8C%EB%A0%A4%EC%A4%98위 링크 내용을 참조로 typeorm-ex.decorator.ts 파일과 typeorm-ex.module.ts 파일을 생성합니다.해당 링크가 문제가 될 시 링크 바로 삭제하도록 하겠습니다 ㅠ.. typeorm.config.tsentities를 불러오기 위해 경로 또는 저희가 설정한 entitiy를 바로 집어 넣었습니다.autoLoadEntities: true - entities를 빼고 해당 옵션을 넣어서 자동으로 불러올 수도 있습니다. (본인이 직접 컨트롤 하는 것이 아니기 때문에 부정확해질 수도 있음.)board.repository.ts저희 repository에 @EntityRepository 대신 CustomRepository(Board)을 넣어줍니다.board.module.tsimports는 custom Repository를 불러와야 하기 때문에, 저희가 만든 TypeOrmExModule class의 forCustomRepository에 저희 Repository를 넣어줍니다.board.service.ts기존에 @EntityRepository를 사용한 경우 @InjectRepository 데코레이터를 사용했지만 해당 부분을 유지하면 오류가 발생한다고 합니다.따라서 @CustomRepository를 생성하여 사용하는 경우 @InjectRepository를 제거하고 사용합니다. 이러면 아직 findOne 메소드의 id는 빨간줄인데findOne 메소드는 options로 FindOneOptions Parameter를 받게 되어 있고해당 FindOneOptions중 저희가 사용할 것은 where 옵션을 사용해야 해당 id를 통해 데이터를 불러올 수 있습니다.그래서 최종적으로 findOne 메소드는 아래 그림과 바꿔주면 해당 메소드를 사용할 수 있게 됩니다.
- 미해결따라하며 배우는 NestJS
nested json을 dto로 전달하려면 어떻게 해야하나요?
1개의 json 객체 안에 프로퍼티가 다른 여러 객체들이 들어있는 리스트가 담겨있는 것을 dto로 전달하려면 어떻게 해야하나요?구글링해보니까 nested 인터페이스를 사용하기도 하던데,Entity는 일반적으로 class로 만드니까 nested class는 어떻게 생성하는지가 궁금합니다.그리고 제 목표는 저 json 인에 들어있는 2가지 종류의 객체( slider type과 selecrive type)를 1번의 post메소드로만 보내고 싶습니다. 그런데 아래처럼 두 객체의 프로퍼티가 다를때, 하나의service,controller,repository를 이용해서 전달하려면 어떻게 해야하나요?json 객체의 형태는 아래와 같습니다.{ "questions_count": 8, "results_slider": [ { "type": "slider", "main_criteria_id": 0, "main_criteria": "Mollit mollit qui sint irure do ad laborum quis ullamco eu dolor.", "sub_criterias": [ "Eu occaecat pariatur sunt duis amet in sint velit amet consequat deserunt.", "Culpa Lorem nisi ut ea irure et eu do cupidatat ipsum duis veniam elit." ], "results": [ { "sub_criteria_id": 0, "sub_criteria_score": 4.7748 }, { "sub_criteria_id": 1, "sub_criteria_score": 7.091 } ] }, { "type": "slider", "main_criteria_id": 1, "main_criteria": "Qui consequat ullamco aliquip Lorem minim commodo irure magna cillum.", "sub_criterias": [ "Velit eu ullamco id nisi quis consequat non non commodo aliquip qui mollit.", "In esse amet proident dolore do aliquip est deserunt commodo eu eiusmod cillum.", "Nisi laboris velit Lorem irure." ], "results": [ { "sub_criteria_id": 0, "sub_criteria_score": 8.1561 } ] } ], "results_selective": [ { "type": "selective", "selective_criteria_id": 0, "selective_criteria": "Aute veniam quis adipisicing sint est amet aliquip elit.", "results": [ { "option_id": 0, "option_score": 3 }, { "option_id": 1, "option_score": 4 }, { "option_id": 2, "option_score": 5 }, { "option_id": 3, "option_score": 2 } ] }, { "type": "selective", "selective_criteria_id": 1, "selective_criteria": "Ipsum culpa dolore ad culpa amet aute ad.", "results": [ { "option_id": 0, "option_score": 3 } ] } ]}
- 미해결따라하며 배우는 NestJS
저는 왜 import가 자동으로 되지 않을까요?
혹시 관련 모듈이나 단축키가 있을까아ㅛ?이번 강의에서는 BaseEntity가 영상에서 보면 자동으로 import가 되던데 저는 되지 않습니다;