inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

176만명의 커뮤니티!! 함께 토론해봐요.

다중 로그인을 막고 싶다면 추가로 어떻게 구현하는 것이 좋을까요?

해결됨

[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core

안녕하세요! 현재 구현된 로직 상에서는 연속으로 여러번 로그인 리퀘스트를 보내더라도 모든 accessToken으로 인증을 통과하는게 가능하던데 다중 로그인을 막고 싶은 경우 어떠한 점을 고려하면 좋을 지 강사님께서 추천하시는 방법이 있을까요?

  • javascript
  • typescript
  • rest-api
  • nestjs
  • backend
jhreplay.lee 댓글 1 좋아요 0 조회수 333

배열

해결됨

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

배열 안에 자료형이 여러가지 된 숫자, 문자열 , 볼린 값들을 저장이 가능합니까?

  • javascript
  • node.js
  • docker
  • rest-api
  • nestjs
navruzbek-1998_ 댓글 2 좋아요 0 조회수 216

노션 링크 어디에 있나요?

해결됨

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

아무리 찾아봐도 링크 주소를 찾지 못해서 링크 주소 올려주시면 감사드립니다.

  • javascript
  • node.js
  • docker
  • rest-api
  • nestjs
corp.starcoex 댓글 1 좋아요 0 조회수 279

query 없이 mutation 만작성하면 오류가 난다?

해결됨

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

안녕하세요~ 복습중 이상한 현상이 발생하여 질문드립니다~ 답변 주시면 감사하겠습니다~ 질문1.resolver 부분에서 boards() 부분의 주석 부분을 해제해야, 맨아래 3번 오류가 발생하지 않고, 정상 작동 합니다. Query 없이 Mutation 만작성하면 오류가 발생하는걸까요? 아래 코드와 같이 query 부분을 주석 처리 하면 왜 오류가 나는 걸까요? 질문2. 에러가 내가 작성한 파일의 어떤부분이 잘못됐다고, 알려주는건 없는 걸까요? 아래 에러 코드를 보면 내가 작성한 코드가 아닌 작성하지도 않은 설치 파일같은데서 error 정보가 나오는데, 저기를 열어봐야 할까요? GraphQLError: Query root type must be provided. at SchemaValidationContext.reportError (C:\study\00-codecamp-backend\연습장\memo01\node_modules\graphql\type\validate.js:73:7) 1.resolver import { Args, Mutation, Resolver } from '@nestjs/graphql'; import { BoardsService } from './boards.service'; import { CreateBoardInput } from './dto/create-board.input'; import { Board } from './entities/board.entity'; @Resolver() export class BoardsResolver { constructor(private readonly boardsService: BoardsService) {} // @Query(() => String) // boards(): string { // return this.boardsService.boards(); // } @Mutation(() => Board) createBoard( @Args('createBoardInput') createBoardInput: CreateBoardInput, // ): Promise<Board> { return this.boardsService.create({ createBoardInput }); } } 2.service import { Injectable } from '@nestjs/common'; import { Repository } from 'typeorm'; import { InjectRepository } from '@nestjs/typeorm'; import { IBoardsServiceCreate } from './interfaces/boards-service.interface'; import { Board } from './entities/board.entity'; @Injectable() export class BoardsService { constructor( @InjectRepository(Board) private readonly boardsRepository: Repository<Board>, // ) {} // boards() { // return 'boards'; // } create({ createBoardInput }: IBoardsServiceCreate): Promise<Board> { return this.boardsRepository.save({ ...createBoardInput }); } } 3.error [ GraphQLError: Query root type must be provided. at SchemaValidationContext.reportError (C:\study\00-codecamp-backend\연습장\memo01\node_modules\graphql\type\validate.js:73:7) at validateRootTypes (C:\study\00-codecamp-backend\연습장\memo01\node_modules\graphql\type\validate.js:89:13) at validateSchema (C:\study\00-codecamp-backend\연습장\memo01\node_modules\graphql\type\validate.js:41:3) at graphqlImpl (C:\study\00-codecamp-backend\연습장\memo01\node_modules\graphql\graphql.js:60:63) at C:\study\00-codecamp-backend\연습장\memo01\node_modules\graphql\graphql.js:23:43 at new Promise (<anonymous>) at graphql (C:\study\00-codecamp-backend\연습장\memo01\node_modules\graphql\graphql.js:23:10) at GraphQLSchemaFactory.create (C:\study\00-codecamp-backend\연습장\memo01\node_modules\@nestjs\graphql\dist\schema-builder\graphql-schema.factory.js:50:65) at GraphQLSchemaBuilder.generateSchema (C:\study\00-codecamp-backend\연습장\memo01\node_modules\@nestjs\graphql\dist\graphql-schema.builder.js:35:52) at GraphQLSchemaBuilder.build (C:\study\00-codecamp-backend\연습장\memo01\node_modules\@nestjs\graphql\dist\graphql-schema.builder.js:22:31) { path: undefined, locations: undefined, extensions: [Object: null prototype] {} } ] C:\study\00-codecamp-backend\연습장\memo01\node_modules\@nestjs\graphql\dist\schema-builder\graphql-schema.factory.js:56 throw new schema_generation_error_1.SchemaGenerationError(errors); ^ Error: Schema generation error (code-first approach) at GraphQLSchemaFactory.create (C:\study\00-codecamp-backend\연습장\memo01\node_modules\@nestjs\graphql\dist\schema-builder\graphql-schema.factory.js:56:23) at processTicksAndRejections (node:internal/process/task_queues:96:5) at GraphQLSchemaBuilder.generateSchema (C:\study\00-codecamp-backend\연습장\memo01\node_modules\@nestjs\graphql\dist\graphql-schema.builder.js:35:24) at GraphQLSchemaBuilder.build (C:\study\00-codecamp-backend\연습장\memo01\node_modules\@nestjs\graphql\dist\graphql-schema.builder.js:22:20) at GraphQLFactory.generateSchema (C:\study\00-codecamp-backend\연습장\memo01\node_modules\@nestjs\graphql\dist\graphql.factory.js:27:41) at GraphQLModule.onModuleInit (C:\study\00-codecamp-backend\연습장\memo01\node_modules\@nestjs\graphql\dist\graphql.module.js:109:27) at callModuleInitHook (C:\study\00-codecamp-backend\연습장\memo01\node_modules\@nestjs\core\hooks\on-module-init.hook.js:51:9) at NestApplication.callInitHook (C:\study\00-codecamp-backend\연습장\memo01\node_modules\@nestjs\core\nest-application-context.js:223:13) at NestApplication.init (C:\study\00-codecamp-backend\연습장\memo01\node_modules\@nestjs\core\nest-application.js:100:9) at NestApplication.listen (C:\study\00-codecamp-backend\연습장\memo01\node_modules\@nestjs\core\nest-application.js:169:33)

  • javascript
  • node.js
  • docker
  • rest-api
  • nestjs
김주원 댓글 1 좋아요 0 조회수 360

port 5432 failed: recived invalid response to ssl negotiation

미해결

따라하며 배우는 NestJS

이런 오류메세지가 나오는데 방법좀 부탁드립니다. nestJS서버는 5432포트로 돌아가고 있습니다!!

  • postgresql
  • jwt
  • nestjs
  • typeorm
meyou1218 댓글 1 좋아요 0 조회수 835

에러 해결하고 데이터베이스 초기화하기 파트

미해결

[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 코드팩토리 통합 링크 https://links.codefactory.ai 안녕하세요 혹시 원래 만든 postModel 인터페이스에서 export interface PostModel { id: number ; author: string ; title: string ; content: string ; likeCount: number ; commentCount: number ; } 이렇게 author가 string으로 되어있어서 오류가 나오는데 이건 어떻게 처리하나요? The expected type comes from property 'author' which is declared here on type 'DeepPartial<PostModel>' 터미널에서는 이렇게 오류가 나옵니다 타입 관련 오류인데 이게 아래에선 postmodel을 받는데 author을 authorId가 들어간 객체로 받는데 위에선 선언을 string으로 해줬는데 이것도 잘 이해가 안 갑니다.. async createPost(authorId: number , title: string , content: string) { // 1) create -> 저장할 객체를 생성한다. // 2) save -> 객체를 저장한다. (create 메서드에서 생성한 객체로) const post = this.postsRepository.create({ author: { id: authorId , } , title , content , likeCount: 0, commentCount: 0, }) ; const ne wPost = await this.postsR epository.save(post) ; return newPost ; }

  • javascript
  • typescript
  • rest-api
  • nestjs
  • backend
채 수 댓글 1 좋아요 0 조회수 515

관계형 연결되어있는 DB 모델 삭제 시 에러 처리

해결됨

[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core

안녕하세요. 강의 잘 듣고 있습니다. image multer 적용 후, 몇가지 api를 테스트 하던중에 아래와 같은 에러가 발생하여, 해결하고자 시도를 해보았는데 잘 해결 되지 않아 질문 드립니다. 에러 메세지 QueryFailedError: update or delete on table "posts_model" violates foreign key constraint "FK_40cd89c6655ec7b102842feacab" on table "image_model" 에러 발생 상황 - image가 post 모델에 관계형이 지어있는 상황에서, post를 지우려고 하면 (deletePost API 사용) 위와 같은 에러 메세지가 나오며 에러가 발생합니다. 에러 해결을 위한 시도 - onDelete : "CASCADE" 옵션을 posts model에 주고, db를 초기화 한후 다시 시도해보았지만 같은 상황이 발생하였습니다. 해당 에러를 어떤식으로 해결해야할지 말씀 부탁드립니다.

  • javascript
  • typescript
  • rest-api
  • nestjs
  • backend
dhj100 댓글 1 좋아요 1 조회수 458

예외처리, 함수 Return type 관련하여 질문 드립니다!

해결됨

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

안녕하세요! 수업 수강 중 궁금한 부분이 생겨 질문 드립니다! 질문 1) Section 11-01 수업 중 users.service.ts 에서 create 함수를 만들 때 const user = await this.findOneByEmail({ email }); if (user) throw new ConflictException('이미 등록된 이메일입니다.'); 위와 같이 email을 검사하고 이미 이메일이 있으면 예외처리를 해주게 되는데 Entity 구현 시 email에 { unique: true } 를 주어도 위 코드처럼 예외처리를 해주어야 하는건가요? 질문 2) Section 10의 products.service.ts 에서 create 함수를 만들 때 함수의 return type은 Promise<Product> 로 구현을 했는데, const result2 = this.productsRepository.save({ ...product, productSalesLocation: result, productCategory: { id: productCategoryId, // 만약 name 까지 받고 싶으면? // => createProductInput에 name까지 포함해서 받아오기 }, productTags: tags, }); return result2; 이런 식으로 result2 를 return 하게 되면 플레이그라운드에서 return 을 선택할 때 productCategory.name 까지 선택할 수 있게 되어 있더라구요. 주석에 쓰여진 내용처럼 name 을 받고 싶으면 createProductInput 에 name을 포함하면 되지만, 지금 처럼 id만 save할 경우, 프론트 개발자 또는 이 API 사용자에게는 productCategory.name 이 없다고 매 번 설명을 해야하는 번거로움이 있을 것 같은데 이런 경우 함수의 return type을 새로 정의하기도 하나요? ex) class ProductsServiceCreateReturn ...

  • javascript
  • node.js
  • docker
  • rest-api
  • nestjs
00_3 댓글 2 좋아요 0 조회수 234

이미지파일 선 업로드 방식에서 update 로직

미해결

[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core

강사님 안녕하세요. 파일 업로드 기능 중 선 업로드 방식에서 update로직을 구현하려고 합니다. 한 개의 포스트에 1,2,3 이미지를 인서트 해당 포스트에 이미지를 2번 삭제하고 4번 추가 하여 업데이트 이럴 경우, 이미지 테이블을 모두 삭제한 후 1,3,4 이미지 파일명을 이미지 테이블에 넣어주면 될까요?1,3 이미지는 public/post 경로에 이미 있고 3이미지는 temp 경로에 있을텐데 public폴더와 temp 폴더를 모두 access 해봐서 temp에 있는 경우만 이미지 파일위치를 옮겨주면 될지 Update를 어떻게 구현하면 좋을지.,문의드립니다. 좋은강의 정말 감사합니다!

  • javascript
  • typescript
  • rest-api
  • nestjs
  • backend
olivejuice 댓글 1 좋아요 1 조회수 568

yarn add @apollo-server 405 에러...

해결됨

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

설치하려하는데 405 에러 나오네요.... 검색해서 나오는것도 몇가지 해보긴했는데... 해결이 안되서 올려봅니다~ ## 에러메시지 Error: https://registry.npmjs.org/@apollo-serve r: Request "https://registry.npmjs.org/@apollo-serve r" returned a 405

  • javascript
  • node.js
  • docker
  • rest-api
  • nestjs
김동민 댓글 1 좋아요 0 조회수 671

post 업데이트 코드 이렇게 작성해도 되나요?

해결됨

[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core

async patchPost(id: number, title: string, content: string, author: string) { const post = await this.postsRepository.save({ id, title, content, author, }); if (!post) { throw new NotFoundException(); } return post; }

  • javascript
  • typescript
  • rest-api
  • nestjs
  • backend
southgyuios19 댓글 1 좋아요 0 조회수 302

ts-node extends시 에러가 발생합니다 ㅠㅠ

해결됨

타입스크립트의 모든 것

tsconfig.json에서 "extends": "@tsconfig/node16/tsconfig.json", extends를 하고 다시 ts-node 명령어를 실행하면 아래와 같이 에러가 발생합니다. tsconfig.json을 주석처리하고 ts-node를 하면 잘 수행됩니다..! /usr/local/lib/node_modules/ts-node/src/index.ts:859 return new TSError(diagnosticText, diagnosticCodes, diagnostics); ^ TSError: ⨯ Unable to compile TypeScript: error TS6053: File '@tsconfig/node16/tsconfig.json' not found. at createTSError (/usr/local/lib/node_modules/ts-node/src/index.ts:859:12) at reportTSError (/usr/local/lib/node_modules/ts-node/src/index.ts:863:19) at createFromPreloadedConfig (/usr/local/lib/node_modules/ts-node/src/index.ts:874:36) at phase4 (/usr/local/lib/node_modules/ts-node/src/bin.ts:543:44) at bootstrap (/usr/local/lib/node_modules/ts-node/src/bin.ts:95:10) at main (/usr/local/lib/node_modules/ts-node/src/bin.ts:55:10) at Object.<anonymous> (/usr/local/lib/node_modules/ts-node/src/bin.ts:800:3) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) { diagnosticCodes: [ 6053 ] } 현재 노드 버전 : v17.0.1 노드를 완전 삭제 및 다시 설치해도 동일한 현상이 발생하고 노드 버전을 올리고 내려도 동일한 현상이 발생하네요.. 혹시 해당 에러가 왜 발생할까요? ㅠㅠ 검색을 해도 잘 나오지가 않네요 ㅠㅠ

  • typescript
  • Deno
  • nestjs
앙빙빙 댓글 1 좋아요 0 조회수 890

Github

해결됨

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

터미널에 'git push origin master'를 입력하고 엔터를 누르면 fatal: 'origin' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. 이렇게 나와고 있어요. 어디서 실수했어요?

  • javascript
  • node.js
  • docker
  • rest-api
  • nestjs
navruzbek-1998_ 댓글 2 좋아요 0 조회수 267

yarn start:dev 이후 에러

해결됨

[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core

docker-compose.yaml 파일 작성하고 postgres-data폴더도 생성하고 app.module.ts도 똑같이 작성되어 있는 상태입니다 도커가 실행되어있고, docker-compose up을 실행한 뒤에 다른 터미널에서 yarn start:dev를 하면 ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)... error: "typeormstudy" �����ͺ��̽� ���� at Parser.parseErrorMessage 이런 에러 메세지가 출력되면서 정상적으로 실행되지 않습니다 이전 강의에서 사용하던 프로젝트도 모두 종료가 되어있는 상태입니다 제가 어딘가를 놓쳐서 나오는 에러일까요..?

  • javascript
  • typescript
  • rest-api
  • nestjs
  • backend
우프베어 댓글 2 좋아요 1 조회수 966

데코레이터-2 강의 질문이 있습니다.

해결됨

타입스크립트의 모든 것

데코레이터-2 강의에서 팩토리 안에 있는 데코레이터 함수를 실행하면 첫번째 인자인 target: Function쪽에는 강의와 다르게 빈값({})이 출력되는데요..! 혹시 이유를 아실까하여 여쭤봅니다..! tsconfig.json에서 말씀해주신 2개의 옵션 수정한 상태입니다. 좋은 강의에 감사의 말씀 전달드립니다!! class HelloController { @Get("/api/v1/user") getRequest() {} } function Get(params: any): any { console.log("Get factory params : ", params); return ( target: any, propertyKey: string, descriptor: PropertyDescriptor) => { console.log("Get deco func : ", target); console.log("Get propertyKey : ", propertyKey); console.log("Get descriptor: ", descriptor); } } 출력값 Get factory params : /api/v1/user Get deco func : {} Get propertyKey : getRequest Get descriptor: { value: [Function: getRequest], writable: true, enumerable: false, configurable: true }

  • typescript
  • Deno
  • nestjs
앙빙빙 댓글 1 좋아요 0 조회수 342

[질문] 토큰 만료에 대한 예외처리 질문

해결됨

[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core

안녕하세요, 현재 강의 를 듣고 있는 수강생입니다. BearerTokenGuard를 작성하고, 토큰 유효기간이 지난 경우에 대해서도 테스트 상황을 가정하여 전날 만들어둔 access token을 authorization header에 넣어 테스트 해보았습니다. 그런데 verifyToken api에 try,catch문이 없어서 500 코드의 에러가 발생하더라구요. 그래서 일단 401 error를 내는게 맞는것 같아서 아래와 같이 작성을 했는데, verify의 결과가 무조건 토큰이 만료된 경우 1가지인지 확실치 않아, 잘 작성된 코드인지 모르겠어서 질문 드립니다. 어떻게 예외처리 코드를 작성하면 좋을까요? /* 해당 API는 토큰을 검증하는 API 입니다. */ verifyToken(token: string) { try { const result = this.jwtService.verify(token, { secret: JWT_SECRET, }); return result; } catch (error) { // to-do : 나중에 최적화 throw new UnauthorizedException('만료된 토큰입니다. 재발급해주세요'); } }

  • javascript
  • typescript
  • rest-api
  • nestjs
  • backend
dhj100 댓글 1 좋아요 0 조회수 665

enum 질문이 있습니다.

해결됨

타입스크립트의 모든 것

안녕하세요! 강의 잘 보구 있습니다. enum에는 값 외에 object나 함수를 지정할 수 없나요? java에서의 enum에서는 값 외에 행위나 인터페이스 등의 타입을 부여할 수 있어서 혹시 가능한지 여쭤봅니다 ㅎㅎ

  • typescript
  • Deno
  • nestjs
앙빙빙 댓글 1 좋아요 0 조회수 372

many to many relations update를 할 경우 질문 드립니다.

해결됨

[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core

안녕하세요. 강의 정말 잘 듣고 있습니다. 먼저 좋은 강의 감사드립니다. 강의를 듣고 복습을 하던 중에, 기존 tag가 relation된 post를 찾아서 새로운 tag를 추가하는 API는 어떤 식으로 짜야 하는지 궁금해서 질문 드립니다.

  • javascript
  • typescript
  • rest-api
  • nestjs
  • backend
dhj100 댓글 2 좋아요 1 조회수 658

AccessToken은 잘 만들어지는데 payload에 아무것도 안담겨요

해결됨

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

로그인 시 받은 accesstoken을 밑에 /user/test의 헤더에 넣었습니다.처음에는 payload에 값이 담겼는데 갑자기 아무것도 안담기네요ㅜㅜ변경사항이 있었던 건 다 돌려봤는데도 도저히 뭐가 문제인지 모르겠어서 남깁니다.뭐가 문제인지도 모르겠어서 코드도 뭘 보여드려야 할 지 모르겠네요ㅜㅜ accesstoekn은 잘 만들어지는데.. 저 accesstoekn으로 UseGuards(AuthGuard('access')) 이 가드를 통과하는 거 아닌가요?validate()까지 간 거 보면 인가는 됐다고 생각했는데 왜 payload에 아무것도 안담기는지 모르겠네요ㅜㅜ

  • javascript
  • node.js
  • docker
  • rest-api
  • nestjs
댓글 1 좋아요 0 조회수 225

인기 태그

인프런 TOP Writers

주간 인기글