inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

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

라우터 클래스 질문입니다

미해결

테스트주도개발(TDD)로 만드는 NodeJS API 서버

var user = require("./api/user"); app.use("/user", user); app.listen(3000, function () { console.log("Example app listening on port 3000"); }); module.exports = app; app.use("/user", user) 이렇게 하면 ./api/user/index.js파일에서 export한 router객체를 자동으로 참조하게 되는건가요? app.use("/user", router) 라고 해야 이해가 될거 같은데...express 문법을 몰라서 질문 올렸습니다

  • node.js
  • express
  • tdd
  • rest-api
가보자!! 댓글 1 좋아요 0 조회수 490

섹션9 Computed Fields 강의에서, 다음 강의 가기 전 빠진부분

미해결

mongoDB 기초부터 실무까지(feat. Node.js)

이거 지워줘야합니다. 안그러면 /:blgoId get 요청 할 때, "error": "commentCount is not defined" 에러 나옵니다. 또, 여기 주석처리 풀어줘야합니다. 안그러면 다음강의에서, comment Post 할 때 "Cannot read properties of undefined (reading 'push')" 에러나요. 수업에서는 이부분에대한 조작없이 이미 되어있는 상태로 진행되고 나오지 않습니다. 다른 분들은 이거 다 알아서 해결하고, 수업진행하신건가;; 에러나서 진행이 안될텐데;; 게시판에 질문들이 없네요. ㅡㅡ;

  • javascript
  • node.js
  • aws
  • mongodb
  • rest-api
  • dbms/rdbms
  • 데이터-엔지니어링
viewee 댓글 1 좋아요 -1 조회수 444

하나의 컨테이너에 api서버와 데이터서버를 같이 관리할 수 있나요?

해결됨

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

강의에서는 api서버와 데이터베이스 서버를 각각의 컨테이너에서 관리하는걸 보여주셨는데 하나의 api서버와 데이터베이스서버를 같이 넣는것도 가능한지 궁금합니다.

  • express
  • docker
  • rest-api
cckdals111 댓글 1 좋아요 1 조회수 563

몽고디비 접속 문제

해결됨

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

노션에 써있는걸로 sudo systemctl start mongod 실행하면 실행이 안되서 공식문서에서 찾아보니 sudo service mongod start 를 입력하면 starting database mongod 라고 뜬 후 fail이 뜹니다.... localhost:27017 로 접속을 하면 잘 뜨긴 하는데 해결 방법이 없을까요 ??

  • javascript
  • node.js
  • express
  • tdd
  • rest-api
  • nestjs
  • mongod
  • mongodb
cgc 댓글 1 좋아요 0 조회수 633

[flask 로 Rest API 구현과 테스트] 질문있습니다

미해결

[리뉴얼] 처음하는 파이썬 백엔드와 웹기술 입문 (파이썬 중급, flask[플라스크] 로 이해하는 백엔드 및 웹기술 기본) [풀스택 Part1-1]

현재 해당 수업을 너무 잘 듣고 있는 수강자입니다~ 이런 강의 제공해주셔서 감사드립니다. 제가 이 강의를 듣게된 이유는 머신러닝 모델을 통해서 모델을 배포하고 결과를 고객에게 보여주기위해 Flask를 사용해보려고 하기 때문인데요.. 아직 지식이 짧아서 그런지, REST API 구현시 ML모델 결과가 만약 Table로 나온다면 이 역시도 JSON 파일로 response를 해줄수가 있는걸까요? 답변 기다리고 있겠습니다.

  • python
  • rest-api
  • flask
A+Plus 댓글 1 좋아요 1 조회수 998

faker 패키지 취약성 이슈

미해결

mongoDB 기초부터 실무까지(feat. Node.js)

faker 패키지 이슈가 생겼습니다. npm i faker로 하면 에러가 발생합니다. npm i -D faker@5 이렇게 하면 될 것 같은데 해도 될까요?

  • javascript
  • node.js
  • aws
  • mongodb
  • rest-api
  • dbms/rdbms
  • 데이터-엔지니어링
  • faker
  • js
띵동 댓글 1 좋아요 1 조회수 540

도커내부 접속 안됨

해결됨

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

docker run 이미지ID 하고 새로운 터미널 열어서 docker ps 로 containerID 확인 후 docker exec -it 명령어 사용해서 도커 내부로 들어가려고 하면 OCI runtime exec failed: exec failed: unable to start container process: exec: "C:/Program Files/Git/usr/bin/bash": stat C:/Program Files/Git/usr/bin/bash: no such file or directory: unknown 이런식으로 오류가 뜹니다 왜 그런건가요?? 해결 방법 알려주세요!

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
cgc 댓글 1 좋아요 1 조회수 1573

라우터 리팩토링

미해결

mongoDB 기초부터 실무까지(feat. Node.js)

해당부분 진행중에, userId 를 넣은 get, post, delete 요청을 할경우, 강의와는 다르게 아래와 같이 error 메세지가 뜹니다. 뭐가 문제인걸까요? userId가 아닌, /user 로 하는 라우팅은 잘 되고 있습니다. /// 내용 추가 이후 강의에서 같은 문제가 발생하여, mongoose를 불러오는 코드를 추가하시는데요. 이부분 앞 강의에서 언급이 되거나 수정이 필요해보입니다.

  • javascript
  • node.js
  • aws
  • mongodb
  • rest-api
  • dbms/rdbms
  • 데이터-엔지니어링
viewee 댓글 1 좋아요 0 조회수 383

섹션4 진행중, mongoose 질문

미해결

mongoDB 기초부터 실무까지(feat. Node.js)

MONGO_URI, 이후 부분들은 작성안해도 에러가 안나는데, 굳이해야하나요? 버젼이 업데이트 되면서 작성 안해도 되도록 바뀐걸까요? 또, 이 부분에서, 여기를 작업해주지 않아도 name 이나 age 둘중 하나만 put 해도, null 값이 들어가지 않는데요. 이 역시 버젼이 올라가서 개선이 된걸까요? 만약 그렇다면, 개정된 강의를 만드실 계획이 있으신지도 궁금합니다 지금 사용하고 있는 몽구스 는 7.0.1 입니다.

  • javascript
  • node.js
  • aws
  • mongodb
  • rest-api
  • dbms/rdbms
  • 데이터-엔지니어링
viewee 댓글 1 좋아요 0 조회수 351

섹션1 - ObjectID

미해결

mongoDB 기초부터 실무까지(feat. Node.js)

여기 이부분은 ObjectID를 ID 가 아닌 Id 로 해주면 되는 부분이 아닌가요? ObjectId 로 하면 잘 나오는데요. 굳이 ObjectID 로 선언을 해줘야하는가 싶어서 질문드립니다.

  • javascript
  • node.js
  • aws
  • mongodb
  • rest-api
  • dbms/rdbms
  • 데이터-엔지니어링
viewee 댓글 1 좋아요 0 조회수 462

nginx 에러

해결됨

비전공자를 위한 풀스택 맛집지도 만들기 프로젝트!: Front, Back-end 그리고 배포까지

강사님처럼 코드 쓰면 이런화면이나오고 delete하고 다시해보면 밑에 화면처럼 나옵니다.. 무슨 문제일까요 이런화면이나오네요

  • HTML/CSS
  • javascript
  • aws
  • git
  • mysql
  • rest-api
  • github
민지홍 댓글 1 좋아요 1 조회수 716

N:M tag 부분 구현 중 findOne 조회 부분 에러

해결됨

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

products.service.ts에서 create 부근에 tag를 저장 하기 전 tag를 미리 조회하는 부분을 구현 중인데 findOne에서 {name: tagname} 을 구현하려고 할 때 다음과 같은 에러가 발생합니다. save에서는 에러가 발생하지 않는데 findOne 조회 부분만 에러가 발생하네요 관련된 코드 같이 보내드립니다. createProduct.input.ts import { 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.ts import { 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.ts import { 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.ts import { 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; } } 내용 확인 부탁드립니다.

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
유상우 댓글 2 좋아요 0 조회수 558

안녕하세요 질문있습니다!

해결됨

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

@ObjectType이랑 @EntryType이랑 같이 사용을 할수는 없는건가요?? dto와 entry가 다른부분이 없어서 같이 쓰는게 낫겠다싶어서 시도하려니 안되네요 확실히 역할을 나눠야하는건가요??

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
gogo 댓글 1 좋아요 1 조회수 400

슈퍼 테스트2 강의 질문입니다

미해결

테스트주도개발(TDD)로 만드는 NodeJS API 서버

describe('GET /users는', () => { it('user리스트를 limit만큼 가져왔다', (done) => { request(app) .get('/users') .end((err, res) => { console.log(res.body) done() // 우리가 만든 API서버는 비동기로 동작한다. 그래서 비동기에 대한 처리로 콜백함수를 호출해야 한다?? }) }) }) 강사님께서 콜백함수 done()을 호출하는 부분에서 다음과 같이 말하셨습니다..."우리가 만든 API서버는 비동기로 동작한다. 그래서 비동기에 대한 처리를 해야한다" 그런데 done()이라는 콜백함수를 호출하는 것이 어떤의미에서 비동기에 대한 처린인지 이해가 가지않아 질문을 남깁니다.

  • node.js
  • express
  • tdd
  • rest-api
가보자!! 댓글 1 좋아요 0 조회수 504

강의 3분경 질문

미해결

[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part6: 웹 서버

데이터를 추가하기 위해 배열을 리스트로 변경하고 시작하는 데 배열에서도 크기를 늘려 데이터추가가 가능할 것 같은데 굳이 리스트로 변경하는 이유가 무엇인지 궁금합니다!

  • rest-api
  • blazor
  • web-api
  • asp.net-core
좋은 캥거루 댓글 1 좋아요 0 조회수 343

응답 강의중 질문입니다

미해결

테스트주도개발(TDD)로 만드는 NodeJS API 서버

Pdf 파일에 "204:내용없음, DELETE"라고 되어 있어 질문이 생겼습니다. 204는 삭제요청을 했는데 내용 없을때 리턴해주는 상태 코드인건가요?? Get요청을 했는데 없을시에도 204를 리턴해 주어도 될까요? 3xx 잘가~ 는 어떤 의미로 받아들여야 할지...이해가 가지 않습니다...

  • node.js
  • express
  • tdd
  • rest-api
가보자!! 댓글 1 좋아요 0 조회수 396

요청 형식 강의 질문입니다

미해결

테스트주도개발(TDD)로 만드는 NodeJS API 서버

HTTP경로로 자원을 식별한다고 알려주셨는데! lecture?user={id} 와 같은 식으로는 사용하지 않는건가요?

  • node.js
  • express
  • tdd
  • rest-api
가보자!! 댓글 1 좋아요 0 조회수 471

비동기 세계1 강의 내용 질문입니다

미해결

테스트주도개발(TDD)로 만드는 NodeJS API 서버

노드는 기본적으로 비동기로 동작한다라는 텍스트가 있는데! console.log()를 출력해보면 동기로 동작하는걸 볼 수 있습니다....기본적으로 위에서 아래로 동기로 동작하는데 비동기로 동작하는 함수가 많다는 의미의 텍스트 일까요?

  • node.js
  • express
  • tdd
  • rest-api
가보자!! 댓글 2 좋아요 0 조회수 554

나만의미니프로젝트 cheerio관련질문

해결됨

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

원하는 키워드의 값을 담은 상수를 console.log(key,value) 하면 줄바꿈되면서 안에 있는 전체 값들이 나오더라구요 ( const key = $(el).attr("property").split(":")[1]; const value = $(el).attr("content"); 부분입니다) 근데 이 값들을 db에 저장하려 for문을 이용해 배열에 넣어봤더니 console.log(key,value)해서 나온 값들이 아닌 마지막 값만 들어갑니다 key와 value에 어떤 형태로 값이 스크랩핑되어 들어가있는건가요..? 상수에 배열형태로 들어간 것도 아니고 한줄로 값이 들어간 것도 아니고 .. console.log하면 전체가 나오기는 하나 줄바꿈이 되어 나와서 갈피를 못잡겠습니다.. 스크래핑한 값을 어떻게 저장을하고 넘겨야할지 db로 넘겨야할지 전혀 모르겠습니다................................. 이틀동안 찾아봐도 해결이 안되어서 질문 남깁니다..

  • NestJS
  • node.js
  • express
  • tdd
  • nodejs
  • rest-api
  • nestjs
  • javascript
  • docker
dada dodo 댓글 1 좋아요 0 조회수 577

스프링 2.7.8 swagger 오류 해결법

미해결

[개정판 2023-11-27] Spring Boot 3.x 를 이용한 RESTful Web Services 개발

pom.xml <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-boot-starter</artifactId> <version>3.0.0</version> </dependency> application.yml spring: mvc: pathmatch: matching-strategy: ant_path_matcher messages: basename: messages

  • spring-boot
  • rest-api
Ond: 댓글 1 좋아요 0 조회수 1108

인기 태그

인프런 TOP Writers

주간 인기글