44,000원
다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결습관부터 바꿔주는 Node.js & Express 기초
swagger /user/detail/:id 조회시 id로 조회 안됩니다.
스웨거에서/users/detail/:id 조회시 id로 조회가 되지 않습니다. const {id} = req.params;id에 해당 값이 들어오질 않네요.req.params 에id:":id" 이렇게 값이 들어옵니다.id: ':id'} github에서 다운받아서 해도 같은 현상입니다.확인 부탁드립니다.
- 미해결습관부터 바꿔주는 Node.js & Express 기초
Axios Mocking에 관한 질문입니다.
// Axios.test.ts import axios from 'axios'; import ManagerService from "./ManagerService"; jest.mock('axios'); const mockedAxios = axios as jest.Mocked<typeof axios>; describe("Axios Test", () => { let managerService = new ManagerService(); it("should mock axios get call", async () => { mockedAxios.get.mockResolvedValue({ data: [ { corporation: "inflearn" } ], }); const test = await managerService.axiosTest("inflearn"); expect(test).toEqual([ { corporation: "inflearn" } ]); expect(mockedAxios.get).toHaveBeenCalledWith(`${process.env.SERVER_URL}/corporation/info`, { params: { corporation: "inflearn" }, }); }); }); 위와 똑같은 코드로 테스트를 진행했고, 본 코드에서는 약간의 차이만 있었습니다.하지만 아직 왜 그렇게 되는지 알지 못하여서 강사님께 여쭤보려고 합니다. 1번 코드 ( 테스트가 잘 동작하는 코드 )axiosTest = async (corporation: string) => { const response = await axios.get(`${process.env.SERVER_URL}/corporation/info`, { params: { corporation: corporation, }, }); if (!response) { throw new Error("값이 없음"); } return response.data; }; 2번 코드 ( 값이 없음으로 에러가 발생하는 코드 )axiosTest = async (corporation : string) => { const site = await axios({ method: 'get', url: `${process.env.SERVER_URL}/corporation/info`, params: { corporation : corporation }, }) if(!site) { throw new Error("값이 없음"); } return site.data } 둘의 차이점에 대해서 알 수 있을까요?
- 미해결습관부터 바꿔주는 Node.js & Express 기초
Express 사용하면서 Jest 테스트 관련해서 질문 드립니다.
// Axios.test.ts import axios from 'axios'; import ManagerService from "./ManagerService"; jest.mock('axios'); const mockedAxios = axios as jest.Mocked<typeof axios>; describe("Axios Test", () => { let managerService = new ManagerService(); it("should mock axios get call", async () => { mockedAxios.get.mockResolvedValue({ data: [ { corporation: "inflearn" } ], }); const test = await managerService.axiosTest("inflearn"); expect(test).toEqual([ { corporation: "inflearn" } ]); expect(mockedAxios.get).toHaveBeenCalledWith(`${process.env.SERVER_URL}/corporation/info`, { params: { corporation: "inflearn" }, }); }); }); 위와 똑같은 코드로 테스트를 진행했고, 본 코드에서는 약간의 차이만 있었습니다.하지만 아직 왜 그렇게 되는지 알지 못하여서 강사님께 여쭤보려고 합니다.1번 코드 ( 테스트가 잘 동작하는 코드 )axiosTest = async (corporation: string) => { const response = await axios.get(`${process.env.SERVER_URL}/corporation/info`, { params: { corporation: corporation, }, }); if (!response) { throw new Error("값이 없음"); } return response.data; }; 2번 코드 ( 값이 없음으로 에러가 발생하는 코드 )axiosTest = async (corporation : string) => { const site = await axios({ method: 'get', url: `${process.env.SERVER_URL}/corporation/info`, params: { corporation : corporation }, }) if(!site) { throw new Error("값이 없음"); } return site.data } 둘의 차이점에 대해서 알 수 있을까요?
- 미해결습관부터 바꿔주는 Node.js & Express 기초
윈도우는 터미널을 뭘 써야하나요?
05:28 부터 윈도우와 맥이 동일하다고 하셨는데 윈도우는 무슨 터미널을 이용해서 진행하나요 ㅠㅠㅠ cmd도 안되고 powershell도 안되고 vim을 깔아봐도 안되는데요..............
- 미해결습관부터 바꿔주는 Node.js & Express 기초
해당 강의 깃허브 주소나
해당 강의 깃허브 주소나디스코드 주소는 어디있나요?
- 미해결습관부터 바꿔주는 Node.js & Express 기초
pm2 start ecosystem.config.js로 실행했는데 require로 작성하는 것에 에러가 뜹니다.
// server-register.cjs require("@babel/register"); require("./index.js"); // ecosystem.config.cjs module.exports = { apps: [ { name: "api", script: "./src/server-register.js", exec_mode: "cluster", watch: false, instances: 0, }, ], }; cli에서 pm2 start ecosystem.config.js로 실행했는데 처음엔 status가 online으로 잘 뜨지만 서버가 실행이 안됩니다. Cannot find module src/server-register.js' imported from /usr/local/lib/node_modules/pm2/lib/ProcessContainer.js 라고 나오는데 install도 다했는데 뭐가 문제일까요?
- 미해결습관부터 바꿔주는 Node.js & Express 기초
포매팅
강의하시면서 자동으로 띄어쓰기같은 포매팅이 되던데단축키인지 아니면 익스텐션인지 알 수 있을까용?
- 미해결습관부터 바꿔주는 Node.js & Express 기초
프리즈마 git repository 질문
이 전 강의에서 프리즈마 실습에 필요한 코드들을 git repoistory 에 올리신다고, 포크 하라고 하셨는데, 깃 계정이름도 바뀌시고, 찾아 들어갔는데 관련 레포지토리를 찾지 못하였습니다 ㅜㅜ 혹시 알 방법이 있을까요??
- 미해결습관부터 바꿔주는 Node.js & Express 기초
Swagger 설정 문의
스웨거에서 paths 가공할 때 강의에서 path를 아래 코드처럼 /detail/:id 이렇게만 작성을 하셨는데, /users는 어디에서 추가를 해야하는지 궁금합니다.export const getUserSwagger = { '/detail/:id': { get: { tags: ['User'], summary: '유저 상세 조회',라우터 분리할 때 /users는 UserController에 path에 추가해서 설정을 했는데, 스웨거에서는 어떻게 해야하나요? 아니면 저 부분을 '/users/detail/:id' 이렇게 풀로 작성해야 하나요?
- 미해결습관부터 바꿔주는 Node.js & Express 기초
섹션 0에 디스코드 주소가 어디에 있나요?
섹션 0에 디스코드 코드가 있다고 하셨는데, 아무리 찾아봐도 보이지가 않습니다. 어디에 있는건가요?
- 미해결습관부터 바꿔주는 Node.js & Express 기초
prisma에서 (비)식별관계 설계
안녕하세요.강의를 보고 현재 첫 프로젝트를 진행중입니다. 전공자라서 이론적으로는 비식별관계와 식별관계에 대해서 인지한 상태인데, prisma로 식별관계를 설정하려면 어떻게 해야할까요? 구글링했는데도 답이 나오질 않네요ㅜㅜ
- 미해결습관부터 바꿔주는 Node.js & Express 기초
유효성 검사
구글링을 통하여 아래와 같이 강의 내용 코드에서 유효성검사를 진행하는 코드를 간단하게 작성하였습니다. 이렇게 하는 방식이 맞을까요?// Middleware import { validationResult } from "express-validator"; export const validatorErrorChecker = async (req, res, next) => { const errors = validationResult(req); if (!errors.isEmpty()) { //에러가 있으면 400 Error return res.status(400).json({ errors: errors.array() }); } next(); } // Controller단 import { Router } from "express"; import { pagination } from "../../../middleware/pagination"; import { body } from "express-validator"; import { validatorErrorChecker } from "../../../middleware/validator" import { UsersDTO, CreateUserDTO, UpdateUserDTO } from "../dto"; import { UserService } from "../service"; // Router class UserController { router; path = "/users"; userService; constructor() { this.router = Router(); this.userService = new UserService(); this.init(); } init() { this.router.get("/", pagination, this.getUsers.bind(this)); this.router.get("/detail/:id", [ //유효성 검사 body('email').exists().isEmail(), body('password').exists().isLength({ min:10, max:20 }), ], this.getUser.bind(this)); this.router.post("/", this.createUser.bind(this)); this.router.patch("/:id", this.updateUser.bind(this)); this.router.delete("/:id", this.deleteUser.bind(this)); } ... } const userController = new UserController(); export default userController;
- 미해결습관부터 바꿔주는 Node.js & Express 기초
prisma schema에서
@@index([$$$$], name: "$$$$")라는 것을 model 안에서 설정해주던데공식문서에 봐도 잘모르겠어요....혹시 설명 부탁드려도 될까요?
- 미해결습관부터 바꿔주는 Node.js & Express 기초
AWS RDS 세팅 중에 오류가 나요...
{username} <- 마스터 사용자 이름{password} <- 마스터 암호 이렇게 입력하는거 맞지 않나요? {databasename} <-여기에 어떤거 입력해야하는지 정확하게 모르겠습니다.강의보고 따라했는데 이렇게 오류가 계속 뜹니다 ... 모가 잘못됐는지 알려주세요~~
- 미해결습관부터 바꿔주는 Node.js & Express 기초
디스코드 채널
디스코드 채널 링크는 어디서 확인할 수 있나요?
- 해결됨습관부터 바꿔주는 Node.js & Express 기초
github 권한
안녕하세요 수업듣다가 github권한에 대해서 문의드립니다.저번에 질문남겨주셨을때도 들어간 링크가 404로 떠서private 레포로 되어있는것 같은데, 권한 요청을 드려야하나요?다른 수업자료들도 전부 private으로 되어있는것 같아요!이렇게 1개의 레포만 확인할 수 있습니다..!
- 미해결습관부터 바꿔주는 Node.js & Express 기초
swagger No operations defined in spec
/swagger.json은 잘 뜨는데/api-docs로 들어가면 'swagger No operations defined in spec!' 이라고 계속 못불러오네요..!수업때 코드 잘 따라친것 같은데, 깃헙에 코드올려주시면 감사하겠습니다..!