inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

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

도커 컴포즈 질문드립니다

해결됨

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

yml파일,mongo 파일,Dockerfile 만들고 docker-compose build docker-compose up 하고 다른 쉘에서 docker ps했는데 아무것도 안뜹니다 파일은 제대로 따라 적었는데도 오류 뜨고 몽고 db는 삭제했고 몽고db 컴패스는 오류걸려서 그냥 삭제했습니다

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

로그인 프로세스 설명 중 질문

해결됨

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

해당 장을 설명해주실 때 철수가 1050번째, 영희가 2050번째라고 가정했을때, 수직 파티셔닝 된 데이터베이스 중 어디에 있는지는 미리 알 수 있는 방법이 있을까요?

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
박호정 댓글 1 좋아요 1 조회수 297

프론트엔드 코드 실행시 에러가 발생합니다.

미해결

탄탄한 백엔드 NestJS, 기초부터 심화까지

>> 갱신, 2023. 10. 06 해결했습니다. https://github.com/amamov/teaching-nestjs-a-to-z/tree/frontend 위 링크 설명 따라 nestjs root 디렉토리에서 git clone 받고, npm install, npm run dev 하니까 잘 실행되네요 $ npm run dev > frontend@0.1.0 dev > next start ready - started server on 0.0.0.0:3000, url: http://localhost:3000 info - Loaded env from C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\.env 잘못된 파일을 받았던것 같습니다.. 어느 질문글에서 본 링크 따라서 들어가서 받았던거로 기억하는데.. 어느 글이었는지 다시 찾아도 보이지 않네요.. >> 질문글, 2023. 10. 04 학습자료 frontend를 다운 받았고, 이 폴더를 05 NestJS 실전 프로젝트와 같은 위치에 두었습니다. 이후 프론트엔드 코드 실행 방법 강의를 보고 frontend 디렉토리로 들어가 npm i를 입력하였습니다 admin@DESKTOP-ALLM3V0 MINGW64 ~/OneDrive/바탕 화면/learning_NestJS/frontend (master) $ npm i npm WARN old lockfile npm WARN old lockfile The package-lock.json file was created with an old version of npm, npm WARN old lockfile so supplemental metadata must be fetched from the registry. npm WARN old lockfile npm WARN old lockfile This is a one-time fix-up, please be patient... npm WARN old lockfile npm WARN deprecated @types/antd@1.0.0: This is a stub types definition for antd (https://github.com/ant-design/ant-design). antd provides its own type definitions, so you don't need @types/antd installed! npm WARN deprecated @types/axios@0.14.0: This is a stub types definition for axios (https://github.com/mzabriskie/axios). axios provides its own type definitions, so you don't need @types/axios installed! npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. added 368 packages, and audited 369 packages in 24s 48 packages are looking for funding run `npm fund` for details 15 vulnerabilities (3 moderate, 7 high, 5 critical) To address issues that do not require attention, run: npm audit fix To address all issues (including breaking changes), run: npm audit fix --force Run `npm audit` for details. 위와 같이 경고 메세지가 나왔고... 이 상태에서 npm run dev를 입력하였더니 admin@DESKTOP-ALLM3V0 MINGW64 ~/OneDrive/바탕 화면/learning_NestJS/frontend (master) $ npm run dev > frontend@0.1.0 dev > next dev ready - started server on 0.0.0.0:3000, url: http://localhost:3000 info - Loaded env from C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\.env info - Using webpack 5. Reason: no next.config.js https://nextjs.org/docs/messages/webpack5 Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:71:19) at Object.createHash (node:crypto:133:10) at BulkUpdateDecorator.hashFactory (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:133790:18) at BulkUpdateDecorator.update (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:133692:50) at OriginalSource.updateHash (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack-sources2\index.js:1:19148) at NormalModule._initBuildHash (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65772:17) at handleParseResult (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65837:10) at C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65928:4 at processResult (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65651:11) at C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65711:5 Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:71:19) at Object.createHash (node:crypto:133:10) at BulkUpdateDecorator.hashFactory (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:133790:18) at BulkUpdateDecorator.update (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:133692:50) at OriginalSource.updateHash (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack-sources2\index.js:1:19148) at NormalModule._initBuildHash (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65772:17) at handleParseResult (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65837:10) at C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65928:4 at processResult (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65651:11) at C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65711:5 node:internal/crypto/hash:71 this[kHandle] = new _Hash(algorithm, xofLen); ^ Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:71:19) at Object.createHash (node:crypto:133:10) at BulkUpdateDecorator.hashFactory (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:133790:18) at BulkUpdateDecorator.update (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:133692:50) at OriginalSource.updateHash (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack-sources2\index.js:1:19148) at NormalModule._initBuildHash (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65772:17) at handleParseResult (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65837:10) at C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65928:4 at processResult (C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65651:11) at C:\Users\admin\OneDrive\바탕 화면\learning_NestJS\frontend\node_modules\next\dist\compiled\webpack\bundle5.js:65711:5 { opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ], library: 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED' } Node.js v18.16.0 위와 같은 에러가 발생하며 프론트엔드가 웹 서버가 실행되지 않고 있습니다.. 이러한 상황에서는 어떻게 진행하면 좋을지 조언 부탁드립니다.

  • node.js
  • mongodb
  • express
  • nestjs
  • ssr
jeongho218 댓글 2 좋아요 1 조회수 693

productsSalesLocation.service create method

해결됨

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

create({productSalesLocation}): Promise<ProductSalesLocation>{ return this.productsSalesLocationsRepository.save({...productSalesLocation}); } 강의 중 위와 같은 코드를 작성해주셨는데, create의 parameter type은 ProductSalesLocation(Entity)의 타입에서 id만 제외하고 사용하는 형태로 작성하는 것이 맞을까요?

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
박호정 댓글 1 좋아요 0 조회수 209

product entity의 deletedAt type

해결됨

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

다음처럼 DeletedDateColumn 데코레이터를 붙인 deletedAt은 db에서 nullable이니까 optional 타입으로 하는 것이 맞을까요? @DeleteDateColumn() deletedAt?: Date; 공식 문서에서는 optional 타입으로 되어 있지는 않네요 https://orkhan.gitbook.io/typeorm/docs/decorator-reference#deletedatecolumn

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
박호정 댓글 1 좋아요 0 조회수 226

mySql DB 는 생성하였는데 테이블이 생성이 안되는 경우가 어떤 게 있을 까요?

해결됨

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

윈도우로 하려니 참 수업이 쫒아가기 힘드네요. 어찌 어찌 구글링으로 계속 진행하고 있는데요. 도커로 올린 후 DB 는 생성을 했는데 테이블 생성이 안되네요. 2. localhost:4000 로 접속을 하면 화면이 보이지도 않구요. 아..도커 참 그렇네요. ^^: 이것 저것 손 댄 코드 입니다. 14 버전이 안되어서 16버전으로 변경 # 컴퓨터 만드는 설명서 # 1. 운영체제 설치(node 14버전과 npm과 yarn이 모두 설치되어있는 리눅스) FROM node:16 # 2. 내 컴퓨터에 있는 폴더나 파일을 도커 컴퓨터 안으로 복사하기 COPY ./package.json /myfolder/ COPY ./yarn.lock /myfolder/ WORKDIR /myfolder/ RUN yarn install COPY . /myfolder/ # 3. 도커안에서 index.js 실행시키기 CMD yarn start:dev DB 포트 충돌로 3307번 확인 후 3306 번 접근 version: '3.7' services: my-backend: build: context: . dockerfile: Dockerfile volumes: - ./src:/myfolder/src ports: - 4000:3000 env_file: - ./.env.docker my-database: platform: linux/x86_64 image: mysql:latest environment: MYSQL_DATABASE: 'mydocker' MYSQL_ROOT_PASSWORD: '0000' ports: - 3307:3306 도움 좀 부탁드립니다.

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
억수 댓글 2 좋아요 0 조회수 1382

socket.io 사용시 랜덤하게 객체가 emit 됩니다.

해결됨

Slack 클론 코딩[백엔드 with NestJS + TypeORM]

안녕하세요 제로초님~ 백엔드 개발자 지망생이자 제로초님의 팬인 신유빈입니다. 1개월 가량 하기 문제를 구글링 하며 여러 경우의 수를 찾아보았지만 이유를 찾지 못하여 질문드립니다. 질문드리고자 하는 내용은 이렇습니다. socket.io 로 이벤트를 emit 할때, 같은 메서드를 사용함 에도 객체에 따라 클라이언트에 전송될 때도 있고, 전송되지 않을 때도 있는데 그 원인을 찾지 못하고 있습니다. 현재 저는 신규게시물 혹은 댓글이 작성되었을때 모든 사용자에게 알림을 emit 하고자 합니다. 현재 3가지의 경우 중 A만 성공중인 상태입니다. A : 테스트를 위하여 handleConnection 메서드에서 소켓에 연결한 사용자의 정보 객체를 message 로 전송시 성공 B : 게시물 작성 시 생성한 알림 메시지 객체를 message 로 전송시 실패 C: 댓글 작성 시 생성한 알림 메시지 객체를 message 로 전송시 실패 모든 케이스에서 클라이언트에게 메시지를 성공적으로 보내려면 어떻게 해야할지 도움을 주실 수 있을까요? // 실행 동영상 https://youtu.be/AgLmcV53EvM // 코드 깃허브 저장소 전체 코드 https://github.com/fog-of-war/dev-be/blob/zerocho/README.md EventsGateway https://github.com/fog-of-war/dev-be/blob/zerocho/src/events/events.gateway.ts#L55 // fow-be/src/events/events.gateway.ts /** 웹소켓 연결시 */ handleConnection(@ConnectedSocket() socket: Socket, client: any) { const interval = setInterval(() => { const userInfo = socket.userInfo; this.sendMessage(userInfo); }, 5000); socket.on("disconnect", () => { clearInterval(interval); }); } /** 메시지 전송 */ sendMessage(message?: any) { console.log(" \n 🌠 sendMessage \n", message); this.server.emit("message", message); return Promise.resolve("Message sent successfully"); } AlertService https://github.com/fog-of-war/dev-be/blob/zerocho/src/alert/alert.service.ts#L12 // fow-be/src/alert/alert.service.ts // B: 게시물 작성시 실행되는 알림 서비스 코드 async createNotifyAlert(id: number) { const data = { alert_place_id: id, alert_type: "NOTIFY" as Type }; const alert = await this.prisma.alert.create({ data: data }); const result = await this.makePostAlertMessage(id); await this.eventsGateway .sendMessage(result) .then((response) => { // console.log("🌠 Notification sent successfully:", response); }) .catch((error) => { console.error("🌠 Error sending notification:", error); // 전송 실패 또는 오류가 발생한 경우에 실행할 로직을 여기에 추가 }); return result; } // fow-be/src/alert/alert.service.ts // C : 댓글 작성시 실행되는 알림 서비스 코드 async createActivityAlert(id: number) { const data = { alert_comment_id: id, alert_type: "ACTIVITY" as Type }; const alert = await this.prisma.alert.create({ data: data }); const result = await this.makeCommentAlertMessage(id); await this.eventsGateway .sendMessage(result) .then((response) => { // console.log("🌠 Notification sent successfully:", response); }) .catch((error) => { console.error("🌠 Error sending notification:", error); }); return result; } // 출력결과 # A : 클라이언트에 전송 성공 🌠 sendMessage { sub: 2, user_email: 'shin.yubin18@gmail.com', iat: 1695983169, exp: 1695986769 } # B : 클라이언트에 전송 실패 🌠 sendMessage { place_id: 1, place_name: '코엑스', region_name: '강남구', post_id: 65, post_created_at: 2023-09-29T10:27:28.371Z, post_image_url: 'https://fog-of-war.s3.ap-northeast-2.amazonaws.com/랜드마크/1코엑스.jpeg' } # C : 클라이언트에 전송 실패 🌠 sendMessage { user_nickname: '구글신유빈', user_image_url: 'https://fog-of-war.s3.ap-northeast-2.amazonaws.com/defaultProfile.png', comment_id: 15, comment_text: '우왕', comment_created_at: 2023-09-29T10:52:24.960Z }

  • node.js
  • express
  • nestjs
신유빈 댓글 3 좋아요 0 조회수 708

res.on('finish')

미해결

탄탄한 백엔드 NestJS, 기초부터 심화까지

안녕하세요 강의 잘 듣고 있습니다. res.on('finish', cb); 이벤트를 걸어뒀다고 가정하고 만약 어떤 request에 의한 비즈니스 로직 수행 중 적당한 예외처리가 되지 못해서 서버가 죽어버리는 로직을 거쳐 res를 쏘는 부분까지 도달하지 못했다면 해당 cb함수는 실행되지 않을거라고 생각했는데 맞을까요? (이렇게 되면.. 어떤 요청에 의해 프로그램이 죽었는지 알기 어려울 것 같다는 생각이 문득 들어서 질문드립니다)

  • node.js
  • mongodb
  • express
  • nestjs
  • ssr
이동현 댓글 1 좋아요 0 조회수 608

redis 질문있습니다.

해결됨

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

redis를 도커로 설치하는 이유가 따로 있을까요?

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
송원 댓글 2 좋아요 0 조회수 341

brew 명령어를 찾을수 없음

해결됨

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

몽고 DB root설정하는 부분에서 이런 오류가 나는데 어떻게 해결해야할까요?

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
정건희 댓글 2 좋아요 0 조회수 467

섹션2-8 openWeatherMap API

해결됨

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

const weatherSearch = function (position) { const openWeatherRes = fetch( `https://api.openweathermap.org/data/2.5/onecall?lat=${position.latitude}&lon=${position.longitude}&appid=4bdfd4f45f4d597908e29058919e8707` ); console.log(openWeatherRes); }; const accessToGeo = function (position) { const positionObj = { latitude: position.coords.latitude, longitude: position.coords.longitude, }; weatherSearch(positionObj); }; const askForLocation = function () { navigator.geolocation.getCurrentPosition(accessToGeo, (err) => { console.log(err); }); }; askForLocation(); fetch 안에 2.5로 변경해도 계속 오류가 떠요 ㅠ 어떻게 해야하나요?

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
김소진 댓글 1 좋아요 1 조회수 275

고양이 정보 커뮤니티 프론트앤드와 합칠 때 오류

미해결

탄탄한 백엔드 NestJS, 기초부터 심화까지

일단 먼저 제 상황을 말씀드릴게요 섹션 4에 강의 협업을 위한 API만들기와 CORS 문제 강의를 듣던중 프론트앤드 파일을 다운받아서 프론트앤드 파일을 열고 회원가입을 해보는 부분에서 프론트 앤드 파일이 열리지 않았습니다. 강의가 작성 된지 시간이 오래 된 것인지 아니면 제가 아직 고양이 정보 커뮤니티에 대한 강의를 다 듣지 못해서 인지 확신이 되지 않아 강사님의 깃허브 05 실전 프로젝트 파일을 다운받아 npm i 로 전부 설치했고(이 때도 워낙 버전이 달라서 버전 fix 를 하는 과정이 필요했습니다.) 그리고 프론트 부분의 파일도 받아서 cd로 프론트파일쪽 폴더로 접근한다음 npm i 로 프론트에 해당하는 패키지까지 전부 설치했습니다. ( 프론트쪽 버전은 백보다 더욱 심각해서 npm install react@latest react-dom@latest 이 명령어를 쳐서 버전업을 하지 않으면 아에 오류가 뜨는 정도였습니다..) 어쨋든 이러한 과정을 마치고 localhost :3000/signup 을 실행하면 이런식으로 오류가 생기면서 되질않았습니다. 이건 일부분의 오류이고 훨씬 더 많은 오류가 생겼습니다. 하나하나 다 열거하기 힘들정도라서 개인적으로 이 코드들을 수정하는것이 제 수준에선 불가능했습니다. 질문에 답변하신 것을 보니 2023년에도 호환성에 문제가 없다고 되어있는데 진짜 그런지 잘모르겠습니다.

  • node.js
  • mongodb
  • express
  • nestjs
  • ssr
늘곰 댓글 1 좋아요 0 조회수 322

비주얼 스튜디오 코드 폴더명 변경시 오류

해결됨

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

section03 의 03-10 폴더를 section04 에 복사 후 이름을 변경하면 error:EPERM: OPERATION NOT PERMITTED 가 떠서, 비주얼스튜디오코드를 종료후 다시 시작해야 변경이 되는데, 복사 붙이기로 붙여넣은 후에는 별다른 작업을 하지 않았는데도, 왜 이런 오류가 발생되는 걸까요? node_modules를 제외하고 복사 후 npm i 로 설치해야 하나요? 매번 계속 시작하려니 시간이 많이 낭비되는듯하여 질문 드립니다~ 답변주시면 감사하겠습니다~

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

색션 2, 데코레이터 개념이 아예 이해가 안됩니다.

미해결

타입스크립트의 모든 것

안녕하세요. 타입스크립트 강좌 수강생 어민규입니다. 데코레이터를 이해하기 위해 필요한 기초지식들을 공부하기 위해 질문을 드립니다. JS가 코딩 입문언어로 그 외 언어들은 알지 못합니다. 그래서 데코레이터가 더 이해가 잘 안되는데요. 참고할만한 블로그나 기초 개념들을 알려주시면 감사하겠습니다. 또한 데코레이터 -2 강의를 기반으로 한 프로그램에서 아래의 오류가 떠서 뭐가 문제인지 잘 모르겠습니다. // 데코레이터 - 2 // 팩토리 // : 데코레이터 함수를 리턴하면서 감싸고 있는 녀석 // f(g(x)) ----> f () { return g () }, g: 데코레이터 함수 // g ----> f(g(x)), f: 데코레이터 팩토리 (목적: 인자전달, param 전달) // 1. 데코레이터는 함수다 function Controller(constructor: any): any { console.log("Controller : ", constructor) return (target: any) => { console.log(target) } } function Get(params: any): any { // console.log("[GET] ", params) } function Post(params: any): any { // console.log("[GET] deco start") } function Column(params: any): any { // console.log("Column!!", params) } function UseGuard(): any { // console.log('UseGuard deco start') } // 2. 데코레이터는 무조건 class만 같이 쓴다. (내부 외부, 맴버 변수, 메소드, 파라미터...) // 데코레이터는 이렇게 쓴다. @Controller('/api/v1') class ExampleController { @Column('email') private _email: string; constructor(email: string) { this._email = email; // _email 변수를 생성자에서 초기화합니다. } @Get('/user') getReq() {} @Post('/board') postReq() {} } // 데코레이터 - 2 var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; for (var i = decorators.length - 1; i >= 0; i--) { var context = {}; for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; for (var p in contextIn.access) context.access[p] = contextIn.access[p]; context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); if (kind === "accessor") { if (result === void 0) continue; if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } if (target) Object.defineProperty(target, contextIn.name, descriptor); done = true; }; var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { var useValue = arguments.length > 2; for (var i = 0; i < initializers.length; i++) { value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; }; var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); }; // 팩토리 // : 데코레이터 함수를 리턴하면서 감싸고 있는 녀석 // f(g(x)) ----> f () { return g () }, g: 데코레이터 함수 // g ----> f(g(x)), f: 데코레이터 팩토리 (목적: 인자전달, param 전달) // 1. 데코레이터는 함수다 function Controller(constructor) { console.log("Controller : ", constructor); return function (target) { console.log(target); }; } function Get(params) { // console.log("[GET] ", params) } function Post(params) { // console.log("[GET] deco start") } function Column(params) { // console.log("Column!!", params) } function UseGuard() { // console.log('UseGuard deco start') } // 2. 데코레이터는 무조건 class만 같이 쓴다. (내부 외부, 맴버 변수, 메소드, 파라미터...) // 데코레이터는 이렇게 쓴다. var ExampleController = function () { var _classDecorators = [Controller('/api/v1')]; var _classDescriptor; var _classExtraInitializers = []; var _classThis; var _instanceExtraInitializers = []; var __email_decorators; var __email_initializers = []; var _getReq_decorators; var _postReq_decorators; var ExampleController = _classThis = /** @class */ (function () { function ExampleController_1(email) { this._email = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, __email_initializers, void 0)); this._email = email; // _email 변수를 생성자에서 초기화합니다. } ExampleController_1.prototype.getReq = function () { }; ExampleController_1.prototype.postReq = function () { }; return ExampleController_1; }()); __setFunctionName(_classThis, "ExampleController"); (function () { var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; __email_decorators = [Column('email')]; _getReq_decorators = [Get('/user')]; _postReq_decorators = [Post('/board')]; __esDecorate(_classThis, null, _getReq_decorators, { kind: "method", name: "getReq", static: false, private: false, access: { has: function (obj) { return "getReq" in obj; }, get: function (obj) { return obj.getReq; } }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(_classThis, null, _postReq_decorators, { kind: "method", name: "postReq", static: false, private: false, access: { has: function (obj) { return "postReq" in obj; }, get: function (obj) { return obj.postReq; } }, metadata: _metadata }, null, _instanceExtraInitializers); __esDecorate(null, null, __email_decorators, { kind: "field", name: "_email", static: false, private: false, access: { has: function (obj) { return "_email" in obj; }, get: function (obj) { return obj._email; }, set: function (obj, value) { obj._email = value; } }, metadata: _metadata }, __email_initializers, _instanceExtraInitializers); __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); ExampleController = _classThis = _classDescriptor.value; if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); __runInitializers(_classThis, _classExtraInitializers); })(); return ExampleController = _classThis; }(); 오류 메시지 eominkyu@pisimingyuui-MacBookAir typeScript % tsc deco && node deco Controller : /api/v1 /Users/eominkyu/Desktop/typeScript/deco.js:13 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); ^ TypeError: (0 , decorators[i]) is not a function at __esDecorate (/Users/eominkyu/Desktop/typeScript/deco.js:13:40) at /Users/eominkyu/Desktop/typeScript/deco.js:90:9 at /Users/eominkyu/Desktop/typeScript/deco.js:97:7 at Object.<anonymous> (/Users/eominkyu/Desktop/typeScript/deco.js:99:2) at Module._compile (node:internal/modules/cjs/loader:1254:14) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) at Module.load (node:internal/modules/cjs/loader:1117:32) at Module._load (node:internal/modules/cjs/loader:958:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 Node.js v18.16.0

  • typescript
  • Deno
  • nestjs
e951219 댓글 1 좋아요 0 조회수 565

중소,스타트업에서는 코딩테스트 안 보는 곳도 있나요?

해결됨

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

중소, 스트타업 채용공고 찾아봤는데 코딩테스트를 보는 곳도 있고 아닌 곳도 있는 거 같아서 무조건 보는 건 아닌가요?

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

section23. 04-06 Mongoose 활용편 질문입니다.

해결됨

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

안녕하세요. MongoDB compass로 mongodb:// localhost:27017 로 접속시, 네임레졸루션으로 설정한 mydocker가 데이터베이스가 보이지 않습니다. 어떻게 하면 MongoDB compass에서 mydocker를 볼 수 있게 할 수 있는지 알려주시면 감사하겠습니다. <네임레졸루션으로 설정한 mydocker> mongoose .connect("mongodb://my-database:27017/mydocker") .then(() => console.log("Connected!")) .catch(() => console.log("Connection Failed")); app.listen(4000, () => { console.log("Back-end API is Open Now"); }); CLI로 MongoDB id "ce236b58a149"로 접속하여 확인하여 보면 mydocker가 확이, Postman으로 확인하여도 POST GET가 잘 됩니다만, MongoDB compass로 접속이 되지 않습니다. <CLI로 mydocker 데이터베이스 확인> hyunminyu@HYUNMINnoAir class % docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ce236b58a149 mongo:5 "docker-entrypoint.s…" 12 seconds ago Up 11 seconds 0.0.0.0:27017->27017/tcp backend-my-database-1 e3f0f648c4c3 backend-my-backend "docker-entrypoint.s…" 21 minutes ago Up 11 seconds 0.0.0.0:4000->4000/tcp backend-my-backend-1 hyunminyu@HYUNMINnoAir class % docker exec -it ce236b58a149 /bin/bash root@ce236b58a149:/# mongo MongoDB shell version v5.0.21 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("181ced5f-7b45-4fd5-bb08-c90762778e68") } MongoDB server version: 5.0.21 ================ Warning: the "mongo" shell has been superseded by "mongosh", which delivers improved usability and compatibility.The "mongo" shell has been deprecated and will be removed in an upcoming release. For installation instructions, see https://docs.mongodb.com/mongodb-shell/install/ ================ --- The server generated these startup warnings when booting: 2023-09-22T15:44:38.346+00:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem 2023-09-22T15:44:39.191+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted --- > show databases admin 0.000GB config 0.000GB local 0.000GB mydocker 0.000GB > use mydocker switched to db mydocker > show collections boards 한가지 의심스러운 점이 있습니다. docker-compose.yaml에서 아래의 27017:27017 포트포워딩을 주석처리하여 docker up을해도, MongoDB compass로 mongodb:// localhost:27017 로 접속이 되는점이 혹시 문제 원인과 관련이 있지 않을까 생각이 듭니다. ports: - 27017:27017 감사합니다.

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
s-june.lee 댓글 2 좋아요 0 조회수 336

강의10-8 관련 질문입니다.

해결됨

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

products.service.ts // 2-2) 상품태그 등록 const tagNames = productTags.map((el) => el.replace('#', '')); const prevTags = await this.productsTagsService.findByNames({ tagNames }); const temp = []; tagNames.forEach((el) => { const isExists = prevTags.find((prevEl) => el === prevEl.name); if (!isExists) temp.push({ name: el }); }); const newTags = await this.productsTagsService.bulkInsert({ names: temp }); const tags = [...prevTags, ...newTags.identifiers]; productsTags.service.ts const newTags = await this.productsTagsService.bulkInsert({ names: temp }); const tags = [...prevTags, ...newTags.identifiers]; products.service.ts 에서 const tags = [...prevTags, ...newTags.identifiers]; 의 결과로 주석으로 {id: "전자제품ID", {id: "컴퓨터ID}, {id: "영등포ID"}} 이렇게 적어주셨는데 ...newTags.identifiers 는 결과가 저렇게 id로 들어가는게 이해되는데 ...prevTags 는 왜 id로 들어가는지 이해가 잘 안됩니다.. prevTags는 키가 id랑 name 두개 있는 객체인데 왜 저렇게 들어가는걸까요 ?? spread 연산자를 사용해서일까요 주석의 예시대로라면 {id: "전자제품ID", name: "전자제품"}, {id: "컴퓨터ID"}, {id: "영등포ID"}} 이런식으로 들어가야 하는거 아닌가요?? 감사합니다

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

socketio 질문 있습니다.

미해결

Slack 클론 코딩[백엔드 with NestJS + TypeORM]

안녕하세요. 마이크로 서비스를 만들어 보고있습니다. 서버끼리는 gRPC 통신을 사용하고, 클라이언트는 게이트웨이를 통해서 HTTP통신을 하는 형태로 만들고있습니다. 요구사항은 이제 어느정도 다 구현이 된 상태인데요. 데이터베이스의 데이터를 모두 보여주는 화면에서 새로운 데이터가 입력됐을때 실시간으로 보여주기 위해서 웹 소켓을 사용하려고 합니다. 그래서 게이트웨이에 웹소켓 게이트웨이를 추가했습니다. import { Inject, OnModuleInit } from '@nestjs/common'; import { MessageBody, SubscribeMessage, WebSocketGateway, WebSocketServer, } from '@nestjs/websockets'; import { Server } from 'socket.io'; import { CounselServiceClient } from './../../../proto/src/counsel'; import { ClientGrpc } from '@nestjs/microservices'; import { firstValueFrom } from 'rxjs'; @WebSocketGateway({ cors: { origin: '*' } }) export class EventsGateWay implements OnModuleInit { counselService: CounselServiceClient; constructor(@Inject('COUNSEL_PACKAGE') private clientCounsel: ClientGrpc) {} onModuleInit() { this.counselService = this.clientCounsel.getService<CounselServiceClient>('CounselService'); } @WebSocketServer() server: Server; @SubscribeMessage('getAllCounselAdmin') async getAllCounselAdmin() { const result = await firstValueFrom( this.counselService.getAllCounselAdmin({}) ); this.server.emit('allCounselAdminData', result); } @SubscribeMessage('getCounselAdmin') async getCounselAdmin(@MessageBody() data: any) { const counselId = data.counselId; const result = await firstValueFrom( this.counselService.getCounselAdmin({ counselId }) ); this.server.emit('counselData', result); } } 이게 지금 웹소켓 게이트웨이의 코드입니다. 클라이언트와 연결하기 위해서 'use client'; import { useEffect, useState } from 'react'; import { CounselProto } from './../../../proto/src/counsel'; import axios from 'axios'; import Long from 'long'; import Link from 'next/link'; import { io } from 'socket.io-client'; export const statusInfoMap: { [key: number]: string } = { 1: '', 2: '', 3: '', 4: '', 5: '', }; export default function GetAllCounselByAdmin() { const [counselData, setCounselData] = useState<CounselProto[]>([]); const [isLoading, setIsLoading] = useState(false); useEffect(() => { const socket = io('http://localhost:3000'); socket.on('connect', () => { console.log('Connected to the server'); }); socket.on('allCounselAdminData', (data) => { console.log('Received data: ', data); setCounselData(data); }); socket.on('disconnect', () => { console.log('Disconnected from the server'); }); return () => { socket.disconnect(); }; }, []); return ( <div> {isLoading ? ( <p>Loading...</p> ) : ( <> <h1>모든 상담 내역 조회</h1> <table> <thead> <tr> <th>[상담 기록 번호]</th> <th>[상담 접수 내용]</th> <th>[상담 진행 상황]</th> <th>[상담 접수 날짜]</th> <th>[고객 고유 번호]</th> <th>[고객 성함]</th> <th>[고객 연락처]</th> </tr> </thead> <tbody> {counselData?.map((item, i) => ( <tr key={i}> <td> <Link href={`/admin/counsel/${item.counselId}`}> {item.counselId} </Link> </td> <td>{item.content}</td> <td>{statusInfoMap[item.statusInfo]}</td> <td>{item.createdAt.toLocaleString()}</td> <td>{item.counselUserId}</td> <td>{item.name}</td> <td>{item.phone}</td> </tr> ))} </tbody> </table> </> )} </div> ); } 이렇게 적고 서버를 실행해서 해당 페이지에 접속을 하니까 콘솔에 Connected to the server 라고는 뜨는데, 데이터가 꽂히지 않고있습니다. 서버로 부터 데이터를 못 받아오고있는것같은데요. 어떤 부분을 손대야할지 모르겠습니다. 해당 소켓 게이트웨이는 공식문서를 참고해서 적었습니다..

  • node.js
  • express
  • nestjs
  • typeorm
뱅준 댓글 1 좋아요 0 조회수 427

웹스톰 사용자인데 cookie를 출력해보면

해결됨

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

console.log(req.headers.cookie); Webstorm-55941cca=39281e1b-d7ae; refreshToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI4ZDM2YTc4Yy1mOWFiLTQ1NjgtODg0NS03MWUzOTQ0ODE1ZjMiLCJpYXQiOjE2OTUyMTI1NzYsImV4cCI6MTY5NjQyMjE3Nn0.8M9UkwgQXS7dGYpq3rxHnSF9TmoEnliY_wbZuhacqL0 이런식으로 출력이 되서 처음에 refreshToken 설정할때 Webstorm-55941cca=39281e1b-d7ae; 이 부분을 없에는 방법이 있을까요? 계속 replace("Webstorm-55941cca=39281e1b-d7ae; refreshToken=','') 이런식으로 없애야 하나요?

  • javascript
  • node.js
  • express
  • docker
  • tdd
  • rest-api
  • nestjs
송원 댓글 1 좋아요 0 조회수 237

섹션23 도커부분 건너띄고, 섹션24 먼저 들어도 될까요?

해결됨

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

도커를 수강하지 않고 섹션 24,25 수강해도 될까요? 도커 이후 수업에서는 도커를 사용해서 수업을 진행하나요?

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

인기 태그

인프런 TOP Writers

주간 인기글