[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core
uuid를 사용하지 않으면 id 값이 너무 단순해 보이는데 값이 쉽게 예측됨으로써 발생하는 보안 문제는 없을까요..? 실제 현업에서는 uuid를 사용하는지 사용하지 않는지 궁금하네요.. 그리고 uuid를 more than을 통해 값을 비교햐여 pagination을 구현하는 것이 가능한가요?
[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core
해당 영상도 또 안나와서 이상해서 개발자도구 켜보니까 /course/lecture?courseSlug=nestjs-%EB%B0%B1%EC%97%94%EB%93%9C-%EC%99%84%EC%A0%84%EC%A0%95%EB%B3%B5-%EB%A7%88%EC%8A%A4%ED%84%B0-%ED%81%B4%EB%9E%98%EC%8A%A4-1&unitId=184136:1 Access to fetch at 'https://vod.inflearn.com/key/9d2b2df0-4061-42e6-a634-42fb7a946b91/68?key=d6303460076ac117c072323d06f3d269d6bd8dfde7e4a95ba3292cce2fdc879 f' from origin 'https://www.inflearn.co m' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. vod.inflearn.com/key/9d2b2df0-4061-42e6-a634-42fb7a946b91/68?key=d6303460076ac117c072323d06f3d269d6bd8dfde7e4a95ba3292cce2fdc879f:1 Failed to load resource: net::ERR_FAILED 인프런 자체 에러가 같은데 원인을 모르겠습니다.
안녕하세요 강의를 만족하며 보고있습니다. 제가 강의를 수강하면서 모르는 부분만 보거나, 필요한 내용들을 그때마다 찾아서 공부하고 있습니다. 하지만 강의가 차례로, 순서대로 해야만 학습 가능한 부분들이있어 공부 하기가 어려운 점이 많습니다. 또 전체적인 코드로 한눈에 흐름을 파악하여 해당 강의 내용을 보고 싶을 때도 많은데, 차례로 강의를 따라가야지만 전체를 볼 수 있기 때문에 어렵습니다. 그래서 세션을 공부하기 위한 베이스 코드나, 강의를 하고 난 완료된 코드를 받고 싶은데 부탁드리겠습니다. 감사합니다.
[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core
계속 postgres 디비 연결하는데 문제가 발생해서요. 해결 방법 알수 있을까요? 다른 비슷한 질문들 보고 port도 변경해 봤는데 [Nest] 4160 - 2023. 12. 12. 오전 10:14:32 ERROR [ExceptionHandler] Entity metadata for UsersModel#postComments was not found. Check if you specified a correct entity object and if it's connected in the connection options. TypeORMError: Entity metadata for UsersModel#postComments was not found. Check if you specified a correct entity object and if it's connected in the connection options. 계속 이렇게 에러가 나서요. 현재 port ‘5433:5432’ 로 연결하고 있습니다. 자세한 방법 부탁드립니다.
안녕하세요~ 강의를 듣다가 제가 뭔가 잘못한건지 actuator에 refresh가 동작하지 않아 질문글을 남깁니다. 강의 2-10번 DB 비밀번호 암호화까지 문제 없이 잘 진행하다 재가동 없이 설정파일 갱신하는 부분을 진행하는데 item-service에서 build.gradle에 의존성 추가하고 bootstrap.yml에 설정 옵션 추가했는데 config-server 설정 파일 변경 후 postman 에서 refresh 요청을 날려도 response body 에는 [] 빈 배열만 찍히고 별다른 문구가 없고 변경된 설정이 적용되지 않더라고요 강의를 봐도 크게 설정하는 부분이 많은건 아니어서 잘 적용된 것 같은데 작동하지 않는 원인이 콘솔에 찍히지 않아서 헤메고 있습니다. build.gradle 의존성과 bootstrap.yml 에 설정 추가하고 config-server 실행시키고 item-service 실행시킨 후 설정 파일에 변경점을 주고 localhost:5000 번으로 /actuator/refresh 요청을 날렸습니다. 그리고 물품등록 요청을 보내서 200코드 성공했는데 별도의 logs 폴더에 api-local2.log는 생기지 않았습니다. 강의와 다르게 한건 인텔리제이로 프로젝트 구성한 것과 스프링부트 마이너 버전만 달라서 크게 문제가 있지는 않을 것 같은데.. 2-10 강의까지 해본 깃 주소도 올려봅니다. https://github.com/doyoun8813/Microservice
안녕하세요~ 복습중 이상한 현상이 발생하여 질문드립니다~ 답변 주시면 감사하겠습니다~ 질문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)
[코드팩토리] [초급] 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 ; }
[코드팩토리] [초급] 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를 초기화 한후 다시 시도해보았지만 같은 상황이 발생하였습니다. 해당 에러를 어떤식으로 해결해야할지 말씀 부탁드립니다.
안녕하세요! 수업 수강 중 궁금한 부분이 생겨 질문 드립니다! 질문 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 ...