묻고 답해요
161만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 레딧 사이트 만들기(NextJS)(Pages Router)
votes기능 부분
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.1.위 이미지처럼 comments.votes를 했는데 저렇게 Array만 뜨는데 값을 가져올 수 있는 건가요?? 위 이미지 처럼 postId와 commentID를 넣은게 아닌 comment 객체와 Post 객체를 넣었는데 어떻게 DB에는 postID와 CommentId가 들어간건지 알 수 있을까요??
-
미해결쿠버네티스 101 - 클라우드/서버 개발 첫걸음
개발 환경에 소개해주신 것들은 직접 설치 하라는 의미인건가요?
개발 환경 강의에서 VS 에서 Google Cloud Code 이외 설치 영상은 없는데처음에 소개해줄 때 알아서 설치하라는 말씀이신가요? Google Cloud Code 익스텐션 설치 후 where.exe minicube 입력 시정보: 제공된 패턴에 해당되는 파일을 찾지 못했습니다.라고 떠서요.
-
미해결풀스택을 위한 도커와 최신 서버 기술(리눅스, nginx, AWS, HTTPS, 배포까지) [풀스택 Part3]
강의자료 문의
안녕하세요. 강의에 첨부된 강의자료 이외에 도커 강의자료 관련 문의 드립니다. 인프런 아이디khd1692@naver.com구글 이메일kkt861104@gmail.com강의명풀스택을 위한 도커와 최신 서버기술 [풀스택 part3]
-
미해결그림으로 배우는 쿠버네티스(v1.30) - {{ x86-64, arm64 }}
7.5강 livenessProbe exec 방식에 관한 질문입니다
livenessProbe는 실행 중 애플리케이션에 문제가 발생하면 애플리케이션이 재기동되는 탐사라고 하셨습니다.탐사 체크 조건을 exec 방식으로 cat /tmp/healthy-on 하도록 했을 때, periodSeconds를 10초 간격으로 주면 아직 애플리케이션 실행이 완료되지 않아 탐사에 실패하여 Unhealthy상태 -> killing상태 -> 앱의 재기동이 반복되는 프로세스는 이해를 했습니다.그런데 periodSeconds 를 30초 간격으로 주었을 때에도 cat /tmp/healthy-on 을 하지 못해 Unhealthy가 떴는데요(livenessProbe failed 됨).그럼 애플리케이션이 재기동되어야 하는 게 아닌가요? 탐사에 실패했는데도 unhealthy 상태를 그대로 유지하는 까닭이 무엇인가요? 그리고 아래 분의 질문에 덧붙여 한 가지 더 질문드리고 싶습니다.livenessProbe일 경우, initialDelaySeconds가 10초이고, periodSeconds가 30초이면, 첫 탐사 체크는 파드 running 후 40초(10초+30초)쯤 이루어진다고 보면 되나요?아직 이해가 부족한 듯하여 부끄럽네요..답변 미리 감사드립니다.
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 레딧 사이트 만들기(NextJS)(Pages Router)
GET http://localhost:4000/images/null 404 (Not Found)
안녕하세요.이미지 업로드 부분을 다 작성하고 이미지까지 잘 올라가지는데console을 보니null:1 GET http://localhost:4000/images/null 404 (Not Found)이런 오류가 뜨는데 무시해도 상관 없는건가요?
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스
N:M tag 부분 구현 중 findOne 조회 부분 에러
products.service.ts에서 create 부근에 tag를 저장 하기 전 tag를 미리 조회하는 부분을 구현 중인데 findOne에서 {name: tagname} 을 구현하려고 할 때 다음과 같은 에러가 발생합니다. save에서는 에러가 발생하지 않는데 findOne 조회 부분만 에러가 발생하네요관련된 코드 같이 보내드립니다.createProduct.input.tsimport { InputType, Field, Int } from '@nestjs/graphql'; import { Min } from 'class-validator'; import { ProductSaleslocationInput } from 'src/apis/productsSaleslocation/entities/dto/productSaleslocation.input'; @InputType() export class CreateProductInput { @Field(() => String) name: string; @Field(() => String) description: string; @Min(0) @Field(() => Int) price: number; @Field(() => ProductSaleslocationInput) productSaleslocation: ProductSaleslocationInput; @Field(() => String) productCategotyId: string; @Field(() => [String]) productTags: string[]; } products.entity.tsimport { Field, Int, ObjectType } from '@nestjs/graphql'; import { ProductCategory } from 'src/apis/productsCategory/entities/productsCategory.entity'; import { ProductTag } from 'src/apis/productsTags/productTags.entity'; import { User } from 'src/apis/users/users.entity'; import { Column, DeleteDateColumn, Entity, JoinColumn, JoinTable, ManyToMany, ManyToOne, OneToOne, PrimaryGeneratedColumn, } from 'typeorm'; import { ProductSaleslocation } from '../../productsSaleslocation/entities/productsSaleslocation.entity'; @Entity() @ObjectType() export class Product { @PrimaryGeneratedColumn('uuid') @Field(() => String) id: string; @Field(() => String) @Column() name: string; @Field(() => String) @Column() description: string; @Field(() => Int) @Column() price: number; @Field(() => Boolean) @Column({ default: false }) isSoldout: boolean; @DeleteDateColumn() deletedAt: Date; @Field(() => ProductSaleslocation) @JoinColumn() @OneToOne(() => ProductSaleslocation) productSaleslocation: ProductSaleslocation; @Field(() => ProductCategory) @ManyToOne(() => ProductCategory) productCategory: ProductCategory; @Field(() => User) @ManyToOne(() => User) user: User; @JoinTable() @ManyToMany(() => ProductTag, (productTags) => productTags.products) @Field(() => [ProductTag]) productTags: ProductTag[]; } productTags.entity.tsimport { Field, ObjectType } from '@nestjs/graphql'; import { Column, Entity, ManyToMany, PrimaryGeneratedColumn } from 'typeorm'; import { Product } from '../products/entities/products.entity'; @Entity() @ObjectType() export class ProductTag { @Field(() => String) @PrimaryGeneratedColumn('uuid') id: string; @Column() @Field(() => String) name: string; @Field(() => [Product]) @ManyToMany(() => Product, (products) => products.productTags) products: Product[]; } products.service.tsimport { Product } from './entities/products.entity'; import { Injectable, UnprocessableEntityException } from '@nestjs/common'; import { Repository } from 'typeorm'; import { InjectRepository } from '@nestjs/typeorm'; import { ProductSaleslocation } from '../productsSaleslocation/entities/productsSaleslocation.entity'; import { ProductTag } from '../productsTags/productTags.entity'; @Injectable() export class ProductService { constructor( @InjectRepository(Product) private readonly productRepository: Repository<Product>, @InjectRepository(ProductSaleslocation) private readonly productSaleslocationRepository: Repository<ProductSaleslocation>, @InjectRepository(ProductTag) private readonly productTagRepository: Repository<ProductTag>, ) {} async findAll() { return await this.productRepository.find({ relations: ['productSaleslocation', 'productCategory', 'productTags'], }); } async findOne({ productId }) { return await this.productRepository.findOne({ where: { id: productId }, relations: ['productSaleslocation', 'productCategory', 'productTags'], }); } async create({ createProductInput }) { // 1. 상품만 등록하는 경우 // const result = await this.productRepository.save({ // ...createProductInput, // // 하나 하나 직접 나열하는 방식 // // name: createProductInput.name, // // description: createProductInput.description, // // price: createProductInput.price, // }); // 2. 상품과 상품거래 위치 같이 등록 const { productSaleslocation, productCategotyId, productTag, ...product } = createProductInput; const result = await this.productSaleslocationRepository.save({ ...productSaleslocation, }); // productTag // ["#electronics, #computer"] const result2 = []; // [{name: ..., id: ...}] for (let i = 0; i < productTags.length; i++) { const tagName = productTags[i].replace('#', ''); // check the tags that has already registered const checkTag = await this.productTagRepository.findOne({ name: tagName, }); // if the tags has been existed if (checkTag) { result2.push(checkTag); // if the tags hasn't been existed } else { const newTag = await this.productTagRepository.save({ name: tagName }); result2.push(newTag); } } const result3 = await this.productRepository.save({ ...product, productSaleslocation: result, // result 통째로 넣기 vs id만 넣기 productCategory: { id: productCategotyId }, productTags: result2, }); return result3; } async update({ productId, updateProductInput }) { const myProduct = await this.productRepository.findOne({ where: { id: productId }, }); const newProduct = { ...myProduct, id: productId, ...updateProductInput, }; return await this.productRepository.save(newProduct); } async checkSoldOut({ productId }) { const product = await this.productRepository.findOne({ where: { id: productId }, }); if (product.isSoldout) { throw new UnprocessableEntityException('Sold out'); } // if(product.isSoldout) { // throw new HttpException('이미 판매 완료 된 상품입니다.', HttpStatus.UNPROCESSABLE_ENTITY) // } } async delete({ productId }) { // 1. 실제 삭제 // const result = await this.productRepository.delete({ id: productId }); // return result.affected ? true : false // 2. 소프트 삭제(직접 구현) - isDeleted // this.productRepository.update({ id: productId }, { isDeleted: true }); // 3. 소프트 삭제(직접 구현) - deletedAt // this.productRepository.update({ id: productId }, { deletedAt: new Date() }); // 4. 소프트 삭제(TypeORM 제공) - softRemove - id로만 삭제 가능 // this.productRepository.softRemove({ id: productId }); // 4 . 소프트 삭제(TypeORM 제공) - softDelete const result = await this.productRepository.softDelete({ id: productId }); return result.affected ? true : false; } } 내용 확인 부탁드립니다.
-
미해결따라하며 배우는 도커와 CI환경 [2023.11 업데이트]
AWS EC2 우분투 서버
안녕하세요?AWS EC2 우분투 서버를 사용하고 있습니다.Docker를 사용하면 AWS service(aws codeBuild , aws codeDeploy)를 사용하지 않고 CI/CD가 가능한가요? 코드는 react/next 입니다. 감사합니다.
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스
안녕하세요 질문있습니다!
@ObjectType이랑 @EntryType이랑 같이 사용을 할수는 없는건가요??dto와 entry가 다른부분이 없어서 같이 쓰는게 낫겠다싶어서 시도하려니 안되네요확실히 역할을 나눠야하는건가요??
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 레딧 사이트 만들기(NextJS)(Pages Router)
댓글 리스트 불러오는 핸들러에서
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 이 부분에서 Comment DB에 postID가 언제 저장된 것일까요??댓글 생성 부분에서는 Post 정보만 저장하지 않았나요?? Post정보를 저장하면 postId가 자동저장되는건가요??댓글을 생성하면 해당 댓글의 postId는 Null값이 아닌가요?
-
미해결따라하며 배우는 도커와 CI환경 [2023.11 업데이트]
redis를 이용한 컨테이너 이해 질문
안녕하세요 강사님 좋은 강의 감사드립니다.docker run redis 명령어를 통해 redis 서버를 작동시키고 해당 컨테이너 안에서 redis-cli가 정삭적으로 연결되어 ping pong이 일어나는 것을 확인했습니다.제가 궁금한 것은 127.0.0.1:6379 가 현재 제 컴퓨터의 로컬에서 redis가 실행되고 있는 건가요..?cmd에서 netstat 을 입력해봐도 6379 포트로 listening하고 있는 프로세스를 확인할 수가 없는데 답변 주시면 감사드리겠습니다.(너무 기초적인 것을 질문했다면 죄송합니다,,)
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 레딧 사이트 만들기(NextJS)(Pages Router)
오류 질문이요!
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 터미널과콘솔에 이렇게 오류가 뜨는데 원인을 모르겠습니다ㅜㅜ
-
미해결초보를 위한 쿠버네티스 안내서
kubectl 설치 관련
현재 윈도우 환경 > 버추얼 박스(미니큐브) 에서 하고있습니다. kubectl 설치가 안되는데 이거.. 깃 배쉬에서 설치를 하는건가요 아니면 cmd..? 아니면 minikube ssh 로 들어가서 안에서 하는걸까요 ㅠㅠ?
-
미해결초보를 위한 쿠버네티스 안내서
docker-compose up -d
안녕하세요. 강사님강의 따라하면서 실습 진행 중입니다.환경은 윈도우 > 버추얼박스 가상머신을 띄어놓았습니다.제가막힌 부분은 minikube 설치 후에cmd or git bash로 minikube ssh 를 통해 서버로 들어가서 docker-compose.yml 파일 만드는거 까지 했는데 그 뒤에 docker-compose up -d 가 안먹혀서요.. 혹시 빠진게 있을까요 ㅠㅠ
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 레딧 사이트 만들기(NextJS)(Pages Router)
pgadmin4 질문입니다
현재 올려주신 pgadmin4 설정과 동일하게 값을 넣어도Undable to connect to server localhostfailed: 치명적오류: 사용자 "postgres"의 password인증을 실패했습니다라는 에러가 떠서 register server에서 방법을인터넷을 보고 제 ip주소도 넣어보고, pg_hba.conf에서 서버 확인하고 locahost, 127.0.0.1 두가지 모두 입력이 먹히지 않네요
-
미해결데브옵스(DevOps)를 위한 쿠버네티스 마스터
버추얼 박스 사용시 각 노드간 연결 문제
강의 내용에 나와 있는 버추얼 박스를 3개 만들어서 쿠버네티스 환경을 만들려고 했습니다. 강의 나온 대로 kubeadm init과 join을 수행했는데, 연결이 계속 안되는 현상이 있었고, 확인해보니 쿠버네티스와는 상관없는 버추얼 박스 VM 간의 통신이 제대로 안되는 이슈였습니다. NAT로 연결되어 있었는데, 어댑터 브릿지로 변경해도 VM 간의 연결이 제대로 안되었습니다. 강의 중에는 연결이 잘되던데, 방법 문의드립니다.
-
미해결그림으로 배우는 쿠버네티스(v1.30) - {{ x86-64, arm64 }}
4.7강에서 endpoints 호출이 안 되는데 이유를 모르겠습니다
실습을 그대로 따라했는데 마지막에 curl external-data를 해도 커넥션이 되지 않습니다. 그 이유를 혹시 아실까요?
-
미해결데브옵스(DevOps)를 위한 쿠버네티스 마스터
강의자료 최신화 요청 드립니다.
안녕하세요, 강의자료 다운로드 화면에서 받아지는 PDF가 현재 강의 내용과 차이가 있습니다.자료 최신화 부탁드립니다~
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 레딧 사이트 만들기(NextJS)(Pages Router)
useSWR 사용시 타입 지정
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 커뮤니티 정보가져오는 useSWR에서는 다른 곳처럼 타입지정을 따로안했는데 원래는 [slug].tsx 에서 사용한 useSWR처럼 타입지정을 해줘야하나요??
-
미해결따라하며 배우는 도커와 CI환경 [2023.11 업데이트]
docker-compose up 시 오류
다른 질문도 참고해보았지만 도저히 해결이 안되네요 아래는 오류 로그입니다.ui-MacBookAir docker-compose-app % docker-compose up [+] Running 2/0 ⠿ Container docker-compose-app-node-app-1 Created 0.0s ⠿ Container docker-compose-app-redis-server-1 Recreated 0.0s Attaching to docker-compose-app-node-app-1, docker-compose-app-redis-server-1 docker-compose-app-redis-server-1 | 1:C 04 Mar 2023 11:43:49.189 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo docker-compose-app-redis-server-1 | 1:C 04 Mar 2023 11:43:49.189 # Redis version=7.0.9, bits=64, commit=00000000, modified=0, pid=1, just started docker-compose-app-redis-server-1 | 1:C 04 Mar 2023 11:43:49.189 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf docker-compose-app-redis-server-1 | 1:M 04 Mar 2023 11:43:49.189 * monotonic clock: POSIX clock_gettime docker-compose-app-redis-server-1 | 1:M 04 Mar 2023 11:43:49.190 * Running mode=standalone, port=6379. docker-compose-app-redis-server-1 | 1:M 04 Mar 2023 11:43:49.190 # Server initialized docker-compose-app-redis-server-1 | 1:M 04 Mar 2023 11:43:49.192 * Ready to accept connections docker-compose-app-node-app-1 | server is running docker-compose-app-node-app-1 | events.js:174 docker-compose-app-node-app-1 | throw er; // Unhandled 'error' event docker-compose-app-node-app-1 | ^ docker-compose-app-node-app-1 | docker-compose-app-node-app-1 | Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379 docker-compose-app-node-app-1 | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14) docker-compose-app-node-app-1 | Emitted 'error' event at: docker-compose-app-node-app-1 | at RedisClient.on_error (/usr/src/app/node_modules/redis/index.js:341:14) docker-compose-app-node-app-1 | at Socket.<anonymous> (/usr/src/app/node_modules/redis/index.js:222:14) docker-compose-app-node-app-1 | at Socket.emit (events.js:198:13) docker-compose-app-node-app-1 | at emitErrorNT (internal/streams/destroy.js:91:8) docker-compose-app-node-app-1 | at emitErrorAndCloseNT (internal/streams/destroy.js:59:3) docker-compose-app-node-app-1 | at process._tickCallback (internal/process/next_tick.js:63:19) docker-compose-app-node-app-1 exited with code 1 ^CGracefully stopping... (press Ctrl+C again to f 나머지는 소스 파일입니다.version: "3" services: redis-server: image: "redis" node-app: build: . ports: - "8080:8080"FROM node WORKDIR /usr/src/app COPY ./ ./ RUN npm install CMD ["node", "server.js"]{ "name": "docker-compose-app", "version": "1.0.0", "description": "", "main": "server.js", "scripts": { "start": "node server.js", "test": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { "express": "4.17.1", "redis": "3.0.2" }, "author": "", "license": "ISC" } const express = require("express"); const redis = require("redis"); // 레디스 클라이언트 생성 const client = redis.createClient({ socket: { host: "redis-server", port: 6379 } }); const app = express(); app.get("/", async (req, res) => { await client.connect(); let number = await client.get("number"); if(number === null){ number = 0; } console.log(`Number : ${number}`); res.send(`숫자가 1씩 올라갑니다. 숫자 : ${number}`); await client.set("number", parseInt(number) + 1); await client.disconnect(); }); app.listen(8080); console.log("server is running");강의 진도를 나갈 수가 없어서 답답합니다.혹시 해결하신분들은 있으신가요..
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 레딧 사이트 만들기(NextJS)(Pages Router)
callback
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 1. 여기서 쓰인 callback 함수의 의미는 어떻게 될까요?? 간단하게 return으로 이해하면 될까요??next()가 없어도 다음 핸들러로 넘어가는 건가요??callback에서 첫번째 인자는 에러를 뜻하고, 두번째 인자는 위에 사진처럼하나는 filename이고하나는 acceptFile: boolean 을 뜻하는데그저 multer의 형식이라고 생각하면 될까요?? 그리고 upload =multer 저 부분이 실행되고 다음 핸들러인 uploadSubImage에서는 이미 파일이 업로드가 된 상태라고 했는데 그럼 upload= multer가 uploadSubImage로 request로 file정보를 보낸건가요?? 로그를 찍어보니까 req는 ownSub에서는 undefined였는데 uploadSubImage에서 생기더라구요...