inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

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

[공유목적] nginx 설정 후 쿠키가 전달되지 않을 경우

해결됨

[리뉴얼] React로 NodeBird SNS 만들기

작성한 이유(저는 이 문제로 골머리를 앓았어서..) 도메인 설정 후 쿠키가 전달되지 않아 로그인이 되지 않았다가 해결되었습니다 session 설정 뿐만 아니라 nginx 설정도 확인해야 합니다 혹시라도 이 문제로 고통받으시는 분이 있다면 해결책이 되길 바랍니다 back 쪽 session 설정 if (process.env.NODE_ENV === "production") { app.use(morgan("combined")); app.use(hpp()); app.use(helmet()); app.set("trust proxy", 1); //배포 시 추가 app.use( cors({ origin: "https://engword.shop", //local "http://localhost:3000" credentials: true, }) ); } else { app.use(morgan("dev")); app.use( cors({ origin: true, credentials: true, }) ); } passportConfig(); app.use(express.json()); app.use(express.urlencoded({ extended: true })); app.use(cookieParser(process.env.COOKIE_SECRET)); app.use( session({ saveUninitialized: false, resave: false, secret: process.env.COOKIE_SECRET, proxy: true, //배포 시 추가 cookie: { httpOnly: true, secure: process.env.NODE_ENV === "production" ? true : false, //https 적용 시 true sameSite: process.env.NODE_ENV === "production" ? "none" : false, domain: process.env.NODE_ENV === "production" && ".engword.shop", }, }) ); nginx 설정 back 에서 설정한 nginx입니다 sudo vim /etc/nginx/nginx.conf server { server_name api.engword.shop; location / { proxy_set_header HOST $host; //추가 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://127.0.0.0:3000 //http로 설정할 것 proxy_redirect off; } //아래는 certbot 내용 } 위와 같이 설정을 바꾼 후 nginx를 다시 실행합니다 sudo systemctl restart nginx pm2 로 진행 시 pm2 를 껏다 키거나, pm2 재시작을 하시면 됩니다. pm2 껏다 키는 경우 sudo npx pm2 kill npm start (혹은 sudo npm start) pm2 재시작 sudo npx pm2 reload all

  • redux
  • react
  • node.js
  • express
  • nodejs
  • next.js
  • Next.js
류지혜 댓글 0 좋아요 1 조회수 2419

UseFilter 데코레이터에 인스턴스? 클래스?

해결됨

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

공식문서 힌트에서, Prefer applying filters by using classes instead of instances when possible. It reduces memory usage since Nest can easily reuse instances of the same class across your entire module. 와 같이, 인스턴스 대신에 클래스를 사용하라고 나와있는데요, 클래스를 사용하는 것이 UseFIlter(HttpExceptionFilter) 가 아니라, UseFIlter(new HttpExceptionFilter()) 이렇게 사용하는 건가요..? 공식문서에서 클래스를 사용하는 것이 권장된다고 나와 있고 클래스로 사용하는 것이 1번인줄 이해했는데, 그 문장 이후에도 2번 과 같이 쓰여서 헷갈려서 질문 올립니다!

  • node.js
  • ssr
  • NestJS
  • mongodb
  • nestjs
  • ssr
  • nodejs
  • express
게으른 개발자 댓글 1 좋아요 0 조회수 549

4092 Error

해결됨

비전공자를 위한 진짜 입문 올인원 개발 부트캠프

8080으로 안되서 검색해서 이것저것 해봐도 안되길래 8090으로 하니까 되는데 8090을 써도 상관 없나요?

  • html/css
  • HTML/CSS
  • 머신러닝 배워볼래요?
  • tensorflow
  • node.js
  • react
  • nodejs
  • 머신러닝
  • react-native
  • javascript
  • express
exwhite 댓글 2 좋아요 1 조회수 577

좋지 않은 예 에서 import

해결됨

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

테스트를 잠깐 해 보았는데요. 다른 모듈에있는 Service를 사용하기 위해서는 (지금까지 배운 내용에 한해서) 1. B Module 에 A Module , A Service 등록하기. 2. B Module 에 A Service 만 등록하기 3. A Module 에서 A Service 를 exports 에 등록하고, B Module에서는 A Module 을 등록하기 정도 생각이 들었고 테스트 해 보았습니다. 강사님꼐서는 1번과 3번을 예시로 들어주셨는데요, 좋지않은 예시(1번) 에서 CatsModule 까지 import 한 이유가 있을까요? AppModule에 CatsModule을 import 하지 않고, CatsService 만 providers 에 등록해 준 것과 다른가요? 아니면, 2번 에서 암시적으로 A Module이 import된다거나 하는게 있는건가요? ++ 인스턴스 가 새로 생성되는 것이라면, 서버사이드에서 는 굳이 싱글톤이 아니어도 될 인스턴스 객체들이 많을 것이라 보이는데, 다른 이유가 있나요?

  • node.js
  • ssr
  • NestJS
  • nodejs
  • nestjs
  • mongodb
  • ssr
  • express
게으른 개발자 댓글 1 좋아요 0 조회수 545

seeder is not a constructor

미해결

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

yarn seed를 통해 더미데이터를 생성하려 했으나 "seeder is not a constructor" 라는 에러에 마주칩니다. 어느 부분이 잘못됫는지 알아보기 위해 에러코드를 살펴봤으나 제 코드 부분이 아닌 typeorm-extension 부분에서 에러가 나는것 같아 해결하기 어렵습니다. TypeError: seeder is not a constructor at /Users/jinyoung/Desktop/try-own-version/practice-version/node_modules/typeorm-extension/src/seeder/module.ts:122:19 at Generator.next (<anonymous>) at fulfilled (/Users/jinyoung/Desktop/try-own-version/practice-version/node_modules/typeorm-extension/dist/seeder/module.js:5:58) dataSource.ts import dotenv from 'dotenv'; //dataSource에 entity를 입력해줄때는 절대경로면 못찾아온다. 그래서 상대 경로로 써줘야함 import { User } from './src/users/entities/user.entity'; import { DataSource } from 'typeorm'; const mode = process.env.NODE_ENV || 'development'; dotenv.config({ path: process.cwd() + `/.env.${mode}` }); const dataSource = new DataSource({ type: 'mysql', host: 'localhost', port: 3306, database: process.env.DB_DATABASE, username: process.env.DB_USERNAME, password: process.env.DB_PASSWORD, charset: 'utf8mb4_general_ci', entities: [User], migrations: [__dirname + '/src/migrations/*.ts'], synchronize: true, logging: true, }); export default dataSource; package.json seed부분 설정 "seed": "ts-node ./node_modules/typeorm-extension/dist/cli/index.js seed -d ./dataSource.ts" database/seeds/create-initial-data.ts import { User } from '../../users/entities/user.entity'; import { DataSource } from 'typeorm'; import { Seeder, SeederFactoryManager } from 'typeorm-extension'; export class UserSeeder implements Seeder { async run( dataSource: DataSource, factoryManager: SeederFactoryManager, ): Promise<any> { const userRepository = dataSource.getRepository(User); await userRepository.save({ email: 'ggg@gmail.com', firstName: 'sfvs', lastName: 'wdwdwd', nickname: 'hihi', }); } } typeorm-extension 버젼 "typeorm-extension": "^2.4.2", "typeorm": "^0.3.12", 시도해본 내용 1. dataSource 생성시 new DataSource({ ... 중략 seed:["create-initial-data.ts 경로"] 추가 }) 2. db 삭제후 다시 생성(생성시 테이블 싱크까지 맞춘후 seed 시도) 3. typeorm-extension 버전 문제일까 해서 다운그레이드 시도 4. typeorm 0.3대는 유지하고 0.3.11, 0.3.10등 다른 버전으로 시도 결과 모두 실패

  • node.js
  • express
  • nestjs
  • nodejs
  • typeorm
  • NestJS
  • TypeORM
양진영 댓글 2 좋아요 0 조회수 850

우분투에 몽고디비 설치 후 실행이 안됩니다.

해결됨

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

제가 사용중인 우분투 버젼입니다. 몽고 디비 설치를 노션 자료에 있는대로도 설치를 해보고, 삭제하고 공식문서에 있는대로도 설치를 해봤는데 (노션에는 공개키가 server-5.0 으로 되어있고 공식 문서는 server-6.0 으로 되어있더라구요) 설치 후에 실행을 해보면 [fail] 이 뜨면서 실행이 되지 않네요. 구글링해서 여러가지 방법 따라해봐도 계속 fail 이어서 질문글 올립니다. 추가로 이상한 점은 mongod --version 이라고 치면 버전이 나오는게 아니라 Illegal instruction 라고 나옵니다. ++구글에 mongod --version Illegal instruction 라는 키워드로 검색을 해서 https://info-orgs.blogspot.com/2021/10/how-to-install-mongodb-v44-mongodb.html 이 글을 보고 몽고 디비 4.4 버전을 설치해봤는데 mongod --version 이라고 치면 이제 버전이 나오긴 하는데 여전히 실행은 실패하네요. $ service mongod start * Starting database mongod /etc/init.d/mongod: 136: ulimit: error setting limit (Operation not permitted) /etc/init.d/mongod: 142: ulimit: error setting limit (Operation not permitted) start-stop-daemon: start-stop-daemon: unable to open pidfile '/var/run/mongod.pid' for writingunable to set gid to 121 (Permission denied) (Operation not permitted) start-stop-daemon: child returned error exit status 2

  • mongodb
  • nodejs
  • express
  • tdd
  • javascript
  • docker
  • rest-api
  • NestJS
alice 댓글 2 좋아요 0 조회수 1220

Saga vs Thunk

해결됨

[리뉴얼] React로 NodeBird SNS 만들기

Redux Toolkit을 써보고 싶은데 고민이 생겼습니다. 제로초 님이 실무에서 리덕스 할 떄 Saga를 더 잘 쓰셨다고 말씀하셨던 거 같습니다. 근데 Redux Toolkit을 쓰려면 Thunk를 쓰는 게 더 편할 거 같은데 어떻게 생각하시나요?? 그리고 이미 Saga를 열심히 배워놨고 익숙해 졌는데 Toolkit를 쓰려고 Thunk로 다시 돌아가야 된다는 게 조금 배웠던 시간이 아깝기도 하고 고민중입니다. 물론 둘 다 동일한 비동기 요청을 하는 기능을 하는 것이지만 배우고 있는 입장에서는 고민이네요. 제로초 님은 Redux Toolkit 쓸 때에도 Saga를 같이 쓰시는 편인가요? +인피니트 스크롤링을 구현할때의 경우도 생각을 해봐야 될 거 같은데, 이부분은 강의를 끝까지 안 들어봐서 어떤 결정이 나을지 모르겠네요

  • express
  • node.js
  • react
  • redux
  • nodejs
  • next.js
  • Next.js
신영 유 댓글 2 좋아요 0 조회수 506

[SOLVED] NestJS 프로젝트 생성 실패

미해결

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

KT망을 사용 중일 경우 ts-jest가 설치되지 않는 문제가 있습니다. 해당 문제는 npm의 registry를 미러 서버로 설정한 뒤 nest new~ 를 통해 프로젝트를 생성하고, 다시 원 서버로 복구하시면 됩니다. npm config set registry https://registry.npmjs.cf/ nest new project npm config set registry https://registry.npmjs.org/ 안녕하세요 4번째 섹션의 첫 강의 NestJS 개발 환경 셋팅 을 보고 NestJS를 통한 Project를 생성하려 합니다. 사용중인 컴퓨터 환경은 다음과 같습니다. Apple Silicon M1 Max MacOS Ventura 13.2 Node: 16.16.0 Npm: 8.11.0 그런데 nest 문서에 나와있는 방법대로 프로젝트를 생성하면 에러가 발생합니다. > nest new project ⚡ We will scaffold your app in a few seconds.. ? Which package manager would you ❤️ to use? npm CREATE project/.eslintrc.js (663 bytes) CREATE project/.prettierrc (51 bytes) CREATE project/README.md (3340 bytes) CREATE project/nest-cli.json (171 bytes) CREATE project/package.json (1938 bytes) CREATE project/tsconfig.build.json (97 bytes) CREATE project/tsconfig.json (546 bytes) CREATE project/src/app.controller.spec.ts (617 bytes) CREATE project/src/app.controller.ts (274 bytes) CREATE project/src/app.module.ts (249 bytes) CREATE project/src/app.service.ts (142 bytes) CREATE project/src/main.ts (208 bytes) CREATE project/test/app.e2e-spec.ts (630 bytes) CREATE project/test/jest-e2e.json (183 bytes) ▹▹▹▹▸ Installation in progress... ☕ Failed to execute command: npm install --silent ✖ Installation in progress... ☕ 🙀 Packages installation failed! In case you don't see any errors above, consider manually running the failed command npm install to see more details on why it errored out. Thanks for installing Nest 🙏 Please consider donating to our open collective to help us maintain this package. 🍷 Donate: https://opencollective.com/nest 그래서 생성된 project 폴더로 이동하여 npm install --verbose를 통해 어디서 실패하는지 확인해 보았더니 다음과 같은 내용을 얻을 수 있었습니다. 로그가 너무 길어서, Error 부분만 넣겠습니다. npm timing idealTree:node_modules/windows-release/node_modules/execa Completed in 32ms npm http fetch GET 200 https://registry.npmjs.org/end-of-stream 28ms (cache revalidated) npm timing idealTree:node_modules/windows-release/node_modules/get-stream Completed in 28ms npm timing idealTree:node_modules/pump Completed in 1ms npm timing idealTree:node_modules/end-of-stream Completed in 0ms npm timing idealTree:node_modules/windows-release/node_modules/human-signals Completed in 0ms npm timing idealTree:node_modules/send/node_modules/debug/node_modules/ms Completed in 0ms npm timing idealTree:buildDeps Completed in 314816ms npm timing idealTree:fixDepFlags Completed in 3ms npm timing idealTree Completed in 314826ms npm timing command:install Completed in 314831ms npm verb type system npm verb stack FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/ts-jest: aborted npm verb stack at ~/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/minipass-fetch/lib/body.js:168:15 npm verb stack at runMicrotasks (<anonymous>) npm verb stack at processTicksAndRejections (node:internal/process/task_queues:96:5) npm verb stack at async RegistryFetcher.packument (~/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/pacote/lib/registry.js:99:25) npm verb stack at async RegistryFetcher.manifest (~/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/pacote/lib/registry.js:124:23) npm verb stack at async Arborist.[nodeFromEdge] (~/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1108:19) npm verb stack at async Arborist.[buildDepStep] (~/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:976:11) npm verb stack at async Arborist.buildIdealTree (~/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:218:7) npm verb stack at async Promise.all (index 1) npm verb stack at async Arborist.reify (~/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:153:5) npm verb cwd ~/Playground/nodejs/inflearn/nestjs/section4/project npm verb Darwin 22.3.0 npm verb node v16.16.0 npm verb npm v8.11.0 npm ERR! code ECONNRESET npm ERR! errno ECONNRESET npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/ts-jest: aborted npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config' npm verb exit 1 npm timing npm Completed in 314906ms npm verb unfinished npm timer reify 1676004665919 npm verb unfinished npm timer reify:loadTrees 1676004665923 npm verb code 1 npm ERR! A complete log of this run can be found in: npm ERR! ~/.npm/_logs/2023-02-10T04_51_05_846Z-debug-0.log NestJS에서 supertest 설치를 위해 jest 패키지를 설치하는 것 같은데, jest 패키지들이 정상적으로 (로그에 의하면 ts-jest) 설치되지 않습니다. 같은 에러를 겪은적 있으시거나, 해결법 아시는 분 도움 부탁드립니다. 감사합니다.

  • node.js
  • nestjs
  • nodejs
  • express
  • mongodb
  • NestJS
  • ssr
말하는 감자 댓글 3 좋아요 0 조회수 4994

npm i vs npm add

미해결

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

현재 Swagger를 활용한 API-Docs 생성 수강중 입니다. 21분 36초에 npm add 로 설치하는데 npm i 와 npm add 의 차이를 앞부분에서 설명해 주셨을까요? 기억이 왜 안날까요?

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

logger.middleware.ts 가 app.module에 적용이 되질않아서 질문드립니다.

미해결

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

제목과 동일한 내용으로 logger middleware를 작성하고 app module에 적용하였습니다. 그리고 재시작을 하여 적용 여부를 확인하려 했으나 적용이 되지않은것을 확인했습니다. 어떤부분을 놓치고 있는지 알고싶습니다. package.json { "name": "a-nest", "version": "0.0.1", "description": "", "author": "", "private": true, "license": "UNLICENSED", "scripts": { "prebuild": "rimraf dist", "build": "nest build", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "start": "nest start", "start:dev-backup": "nest start --watch", "start:dev": "nest build --webpack --webpackPath webpack-hmr.config.js --watch", "start:debug": "nest start --debug --watch", "start:prod": "node dist/main", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "test": "jest", "test:watch": "jest --watch", "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json" }, "dependencies": { "@nestjs/common": "^9.0.0", "@nestjs/config": "^2.3.0", "@nestjs/core": "^9.0.0", "@nestjs/platform-express": "^9.0.0", "axios": "^1.3.2", "reflect-metadata": "^0.1.13", "rimraf": "^3.0.2", "rxjs": "^7.2.0" }, "devDependencies": { "@nestjs/cli": "^9.0.0", "@nestjs/schematics": "^9.0.0", "@nestjs/testing": "^9.0.0", "@types/express": "^4.17.13", "@types/jest": "28.1.8", "@types/node": "^16.0.0", "@types/supertest": "^2.0.11", "@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/parser": "^5.0.0", "eslint": "^8.0.1", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "jest": "28.1.3", "prettier": "^2.3.2", "run-script-webpack-plugin": "^0.1.1", "source-map-support": "^0.5.20", "supertest": "^6.1.3", "ts-jest": "28.0.8", "ts-loader": "^9.2.3", "ts-node": "^10.0.0", "tsconfig-paths": "4.1.0", "typescript": "^4.7.4", "webpack": "^5.75.0", "webpack-node-externals": "^3.0.0" }, "jest": { "moduleFileExtensions": [ "js", "json", "ts" ], "rootDir": "src", "testRegex": ".*\\.spec\\.ts$", "transform": { "^.+\\.(t|j)s$": "ts-jest" }, "collectCoverageFrom": [ "**/*.(t|j)s" ], "coverageDirectory": "../coverage", "testEnvironment": "node" } } logger.middleware.ts import { Injectable, Logger, NestMiddleware } from '@nestjs/common'; import { NextFunction, Request, Response, response } from 'express'; @Injectable() export class LoggerMiddleware implements NestMiddleware { private logger = new Logger('HTTP'); use(req: Request, res: Response, next: NextFunction): void { const { ip, method, originalUrl } = req; const userAgent = req.get('user-agent') || ''; response.on('finish', () => { const { statusCode } = res; const contentLength = res.get('content-type'); this.logger.log( `${method} ${originalUrl} ${statusCode} ${contentLength} - ${userAgent} ${ip}`, ); }); next(); } } app.module.ts import { MiddlewareConsumer, Module, NestModule, RequestMethod, } from '@nestjs/common'; import { AppController } from './app.controller'; import { AppService } from './app.service'; import { ConfigModule, ConfigService } from '@nestjs/config'; import axios from 'axios'; import { LoggerMiddleware } from './middleware/logger.middleware'; const getEnv = async () => { // const response = await axios.get('비밀키를 요청하는 url'); // return response.data; }; const mode = process.env.NODE_ENV || 'development'; @Module({ imports: [ ConfigModule.forRoot({ isGlobal: true, load: [getEnv], envFilePath: `.env.${mode}`, }), ], controllers: [AppController], providers: [AppService, ConfigService], }) export class AppModule implements NestModule { configure(consumer: MiddlewareConsumer): any { consumer .apply(LoggerMiddleware) .forRoutes({ path: '*', method: RequestMethod.ALL }); } } nestjs log Info Webpack is building your sources... Entrypoint main 47.9 KiB = main.js 46.1 KiB 0.5051cca5f9ad96919687.hot-update.js 1.81 KiB webpack 5.75.0 compiled successfully in 63 ms [Nest] 36670 - 02/07/2023, 7:47:49 AM LOG [NestFactory] Starting Nest application... +6659ms [HMR] Updated modules: [HMR] - 10 [HMR] - 5 [HMR] - 3 [HMR] Update applied. [Nest] 36670 - 02/07/2023, 7:47:49 AM LOG [InstanceLoader] ConfigHostModule dependencies initialized +4ms [Nest] 36670 - 02/07/2023, 7:47:49 AM LOG [InstanceLoader] ConfigModule dependencies initialized +0ms [Nest] 36670 - 02/07/2023, 7:47:49 AM LOG [InstanceLoader] AppModule dependencies initialized +0ms [Nest] 36670 - 02/07/2023, 7:47:49 AM LOG [RoutesResolver] AppController {/}: +0ms [Nest] 36670 - 02/07/2023, 7:47:49 AM LOG [RouterExplorer] Mapped {/, GET} route +1ms [Nest] 36670 - 02/07/2023, 7:47:49 AM LOG [NestApplication] Nest application successfully started +0ms 적용이 되지않아 생기는 질문이라 에러코드는 없어서 따로 첨부하지 않았습니다.

  • node.js
  • express
  • nodejs
  • nestjs
  • typeorm
  • TypeORM
  • NestJS
양진영 댓글 2 좋아요 0 조회수 528

워크벤치 포트번호

해결됨

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

워크벤치에, 전에 테스트해 보던게 있었습니다. 포트번호를 겹치지 않게 하려고 다르게 작성하니 OpenConnection 할 때 워크벤치가 그냥 꺼지는데요 포트번호는 항상 같아야 하는 건가요??

  • node.js
  • ssr
  • NestJS
  • nodejs
  • nestjs
  • ssr
  • express
  • mongodb
게으른 개발자 댓글 1 좋아요 0 조회수 532

시퀄라이즈 관계메소드를 두번 사용하는 경우

해결됨

[리뉴얼] React로 NodeBird SNS 만들기

const images = await Promise.all( req.body.image.map((image) => Image.create({ src: image })) ); await post.addImages(images); 이런식으로 Image.create() 를 적용한 다음 다시 post.addImages() 하는 이유가 뭔가요? 중복된 실행이라고 생각했는데 실행해봤을때는 중복된 튜플이 생성되지는 않네요..

  • react
  • node.js
  • redux
  • express
  • next.js
  • nodejs
  • Next.js
kenny 댓글 1 좋아요 0 조회수 270

백엔드 질문

해결됨

[리뉴얼] React로 NodeBird SNS 만들기

1.사용자가 웹에 접속을 할 때, 브라우저 -> 프론트서버 로 요청을 보내게 되고 프론트 -> 브라우저 로 html css js 파일을 보내서 뷰를 표시하게 되는데 그러면 특정 기능을 사용할 때, 예를 들어 로그인 버튼을 누른다고 하면 그 요청은 브라우저 -> 백엔드 인가요 프론트 -> 백엔드 인가요? 만약 브라우저 -> 백엔드 이면 백엔드 cors 설정에서는 프론트서버 도메인만 허용하도록 해놓는데 어떻게 브라우저에서 백엔드로 접근이 가능한건가요? 2.강좌에서는 me값으로 로그인 유지를 위한 로직을 작성했고 모든 페이지 접속 때마다 백엔드로 요청을 보내서 세션인증을 하는방식으로 로직을 작성했는데 제가 알기로 세션인증방식은 세션id를 프론트에 보내서 쿠키에 있는 세션id를 이용해 로그인 유지를 하는것으로 알고있습니다. 제가 알고 있는 방식과 강좌에서의 세션인증이 좀 다른것 같은데 어떻게 이해해야 하나요? 강좌는 ssr 적용 전 백엔드 부분까지만 들은 상태입니다.

  • Next.js
  • node.js
  • express
  • react
  • nodejs
  • next.js
  • redux
kenny 댓글 1 좋아요 0 조회수 382

노션과제에 대한 질문있습니다

해결됨

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

혹시 과제 풀이를 볼수 있는곳이 있을까요?

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

github 권한

해결됨

습관부터 바꿔주는 Node.js & Express 기초

안녕하세요 수업듣다가 github권한에 대해서 문의드립니다. 저번에 질문남겨주셨을때도 들어간 링크가 404로 떠서 private 레포로 되어있는것 같은데, 권한 요청을 드려야하나요? 다른 수업자료들도 전부 private으로 되어있는것 같아요! 이렇게 1개의 레포만 확인할 수 있습니다..!

  • node.js
  • express
  • nodejs
지소라 댓글 1 좋아요 0 조회수 776

8:24분경 코드 오류나서 수정하셨는데!

해결됨

[리뉴얼] React로 NodeBird SNS 만들기

8분 20초경 오류나서 코드를 수정하셨는데, case ADD_POST_TO_ME: return { ...state, me: { ...state.me, // 이부분 왜 추가한건가요? Posts: [{ id: action.data }, ...state.me.Posts], }, }; 코드 주석부분 왜 추가하신건가요..? const dummyUser = (data) => ({ ...data, nickname: "wewewe", id: 1, Posts: [{ id: 1 }], Followings: [{ nickname: "we1" }, { nickname: "we2" }, { nickname: "we3" }], Followers: [{ nickname: "we1" }, { nickname: "we2" }, { nickname: "we3" }], }); dummy데이터 구조를 보면 Posts를 제외한 nickname, id, Followings 등 변하지 않는 데이터들의 불변성을 유지하기 위해서 추가한것이 맞는건가요?!

  • nodejs
  • redux
  • node.js
  • express
  • next.js
  • react
  • Next.js
뽀개즈아 댓글 1 좋아요 0 조회수 302

populate 문제(cats schema 오류) 해결법

미해결

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

강의대로 따라 했으나, 아래와같은 오류 나는경우 해결법 입니다. ERROR [ExceptionsHandler] Schema hasn't been registered for model "comments". Use mongoose.model(name, schema) 다른 문의글 보면 답변으로 버전 문제라고 버전을 내리라고 하시는데 , 좀 이상한 답변이라는 생각에 진짜 몇시간동안 헤매다가 해결했습니다. 현재기준 최신버전 "@nestjs/common": "^9.0.0", "@nestjs/mongoose": "^9.2.1", "mongoose": "^6.9.0", 에서 아래와 같이 해결 했습니다. 주석참조. export class CatsRepository { constructor( @InjectModel(Cat.name) private readonly catModel: Model<Cat>, // 해당 라인 추가, 참고로 강의에선 Comments 인데 저는 Cat과 같이 단수형으로 만들어서 Comment 입니다. @InjectModel(Comment.name) private readonly commentModel: Model<Comment>, ) {} async findAll() { const result = await this.catModel .find() // populate 파라미터 변경 .populate({ path: 'comments', model: this.commentModel }); return result; } ... } 다른 누군가에게 도움이 되기를

  • node.js
  • NestJS
  • ssr
  • express
  • nestjs
  • ssr
  • nodejs
  • mongodb
saltcoffee 댓글 6 좋아요 14 조회수 1088

Delete 'CR' eslint 표시 없애기 공유(windows사용자)

해결됨

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

windows에서 vscode에서 typescript를 사용하시다 보면 아래와 같이 delete 'cr'이라고 계속 빨간 글씨가 떠서 눈에 거슬리는 경우가 있습니다. 해결책 : eslintrc.js파일에 가셔서 아래와 같이 rules에 추가한 후 저장해 주시면 됩니다. 긁어서 eslintrc.js파일의 하단의 rules에 추가해 주세요 'prettier/prettier': [ 'error', { endOfLine: 'auto', }, ],

  • docker
  • node.js
  • rest-api
  • nodejs
  • express
  • javascript
  • nestjs
  • tdd
  • NestJS
똑같이썼는데안돼 댓글 1 좋아요 3 조회수 1061

혹시 테스트 결제 잘 되나요??

해결됨

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

여러 방면으로 시도 중인데, error_code : "NOT_READY" error_msg : "등록된 사용자가 아니거나, 아임포트 관리자 페이지에 설정된 PG정보가 없습니다." 해당 에러가 뜨면서 계속 실패하네요;; 혹시 하신 분들은 어떻게 성공하셨는지 궁금합니다. 일단 제가 예상한 것으로는 강의 화면이랑 제 구 관리자콘솔의 시스템 관리 탭이 다른 점에 눈이 가는데, 이걸 어떻게 처리해야되는지 어디를 찾아봐도 안나오네요... 강의에서는 여러 탭이 있는데 저는 두 개의 탭 밖에 보이지 않습니다. 해결 방법을 찾고 싶어도 어디서 찾아야 되는 지 감이 안잡히네요

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

우분투에서 작업시 윈도우로 mysql 설치하는 것에 관해서

미해결

[리뉴얼] React로 NodeBird SNS 만들기

제로초쌤 제가 우분투에서 Nodebird를 진행하고 있는데 더북에 써져있는 거처럼 리눅스(우분투)에서 설치하는 방법 그대로 설치하다가 Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) 소켓 에러가 계속 나서 해결하려고 인터넷에 찾아보면서 따라하고 있는데 해결이 안되서 혹시 윈도우로 mysql설치해서 진행해도 크게 차이가 없을까요?

  • redux
  • node.js
  • react
  • nodejs
  • next.js
  • express
  • Next.js
CJW 댓글 2 좋아요 0 조회수 422

인기 태그

인프런 TOP Writers

주간 인기글