묻고 답해요
131만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결비전공자를 위한 풀스택 맛집지도 만들기 프로젝트!: Front, Back-end 그리고 배포까지
노션 링크가 어디있나요 ?
노션 링크가 어디있나요 ? 찾기가 어렵네요..
-
미해결[개정판 2023-11-27] Spring Boot 3.x 를 이용한 RESTful Web Services 개발
완강이 안됩니다.
모든 강의를 완료하였으나 98.11%에서 올라가지 않습니다.그래서 수료증을 받을 수 없습니다.
-
해결됨[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - Part 1 NestJS Core
다중 로그인을 막고 싶다면 추가로 어떻게 구현하는 것이 좋을까요?
안녕하세요!현재 구현된 로직 상에서는 연속으로 여러번 로그인 리퀘스트를 보내더라도 모든 accessToken으로 인증을 통과하는게 가능하던데다중 로그인을 막고 싶은 경우 어떠한 점을 고려하면 좋을 지 강사님께서 추천하시는 방법이 있을까요?
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스
배열
배열 안에 자료형이 여러가지 된 숫자, 문자열 , 볼린 값들을 저장이 가능합니까?
-
미해결[개정판 2023-11-27] Spring Boot 3.x 를 이용한 RESTful Web Services 개발
delete 로직 문의
POST 맨으로 삭제 요청을 하였을 때 로그를 확인해 보니삭제 요청 아이디로 select를 한번 날리고 아이디가 존재시에만delete 로직이 수행되는데 이는 jpa 내부 프로세스 자체 로직 인가요?
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스
노션 링크 어디에 있나요?
아무리 찾아봐도 링크 주소를 찾지 못해서 링크 주소 올려주시면 감사드립니다.
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스
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.resolverimport { 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.serviceimport { 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)
-
미해결[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - Part 1 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 newPost = await this.postsRepository.save(post); return newPost;}
-
해결됨[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - Part 1 NestJS Core
관계형 연결되어있는 DB 모델 삭제 시 에러 처리
안녕하세요. 강의 잘 듣고 있습니다.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를 초기화 한후 다시 시도해보았지만 같은 상황이 발생하였습니다.해당 에러를 어떤식으로 해결해야할지 말씀 부탁드립니다.
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스
예외처리, 함수 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 ...
-
미해결[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - Part 1 NestJS Core
이미지파일 선 업로드 방식에서 update 로직
강사님 안녕하세요. 파일 업로드 기능 중 선 업로드 방식에서 update로직을 구현하려고 합니다. 한 개의 포스트에 1,2,3 이미지를 인서트해당 포스트에 이미지를 2번 삭제하고 4번 추가 하여 업데이트 이럴 경우, 이미지 테이블을 모두 삭제한 후 1,3,4 이미지 파일명을 이미지 테이블에 넣어주면 될까요?1,3 이미지는 public/post 경로에 이미 있고 3이미지는 temp 경로에 있을텐데 public폴더와 temp 폴더를 모두 access 해봐서 temp에 있는 경우만 이미지 파일위치를 옮겨주면 될지 Update를 어떻게 구현하면 좋을지.,문의드립니다. 좋은강의 정말 감사합니다!
-
미해결[개정판 2023-11-27] Spring Boot 3.x 를 이용한 RESTful Web Services 개발
마지막 1분 코스가 완료가 안되서, 완강처리가 안됩니다.
마지막 1분 코스가 완료가 안되서, 완강처리가 안됩니다.그래서 수료증을 받을 수가 없습니다.
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스
yarn add @apollo-server 405 에러...
설치하려하는데 405 에러 나오네요....검색해서 나오는것도 몇가지 해보긴했는데...해결이 안되서 올려봅니다~## 에러메시지Error: https://registry.npmjs.org/@apollo-server: Request "https://registry.npmjs.org/@apollo-server" returned a 405
-
미해결[개정판 2023-11-27] Spring Boot 3.x 를 이용한 RESTful Web Services 개발
HATEOAS 3단계 적용 질문입니다 !
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-hateoas</artifactId> </dependency>섹션 4 Level3 단계의 REST API 구현을 위한 HATEOAS 적용에서 오류가 발생했습니다.retrieveAllUsers@GetMapping("/users") public List<User> retrieveAllUsers() { return service.findAll(); }전체 조회 메서드는 잘 작동이 되는데retrieveUser @GetMapping("/users/{id}") public EntityModel<User> retrieveUser(@PathVariable int id) { User user = service.findOne(id); if (user == null){ throw new UserNotFoundException(String.format("ID[%s] not found", id)); } EntityModel<User> entityModel = EntityModel.of(user); WebMvcLinkBuilder linkTo = linkTo(methodOn(this.getClass()).retrieveAllUsers()); entityModel.add(linkTo.withRel("all-users")); return entityModel; }이런 오류가 발생했습니다.어떻게 해결해야 할까요?
-
해결됨[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - Part 1 NestJS Core
post 업데이트 코드 이렇게 작성해도 되나요?
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; }
-
미해결비전공자를 위한 풀스택 맛집지도 만들기 프로젝트!: Front, Back-end 그리고 배포까지
axios 이후 마커 오류
axios로 dataSet을 받아오는 과정에서 undefined오류가 뜨는데 무엇이 문제인가요? 사진은 개발자도구에서 콘솔창에 뜨는 오류랑오류가 발생했다고 하는 98줄의 코드입니다
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스
Github
터미널에 'git push origin master'를 입력하고 엔터를 누르면fatal: 'origin' does not appear to be a git repositoryfatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists. 이렇게 나와고 있어요. 어디서 실수했어요?
-
미해결비전공자를 위한 풀스택 맛집지도 만들기 프로젝트!: Front, Back-end 그리고 배포까지
service nginx restart 에러
우분투 파일 경로를 바꾸기 전까지는 ip주소로 접근했을 때 Welcon to nignx! 까지는 잘 뜨는데이렇게 경로를 바꾸고 service nginx restart 명령어를 입력하면이런 메세지가 뜨면서 다시 ip주소로 접속하려 하면이렇게 사이트에 연결할 수 없다는 메세지가 나옵니다 어떻게 해야할까요...하
-
해결됨[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - Part 1 NestJS Core
yarn start:dev 이후 에러
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 이런 에러 메세지가 출력되면서 정상적으로 실행되지 않습니다이전 강의에서 사용하던 프로젝트도 모두 종료가 되어있는 상태입니다제가 어딘가를 놓쳐서 나오는 에러일까요..?
-
해결됨[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - Part 1 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('만료된 토큰입니다. 재발급해주세요'); } }