에러처리 미들웨어(2)
-
6 주차 ( + 협업을 통해 느낀점 )[ WIL ]
이번주에 알게된 것 CI/CD : https://muyeon95.tistory.com/222 CI/CD CI/CD 란? CI/CD (Contunuous Integration/Continuous Delivery) 는 애플리케이션 단계를 자동화하여 애플리케이션을 더욱 짧은 주기로 고객에게 제공하는 방법 기본적인 개념은 지속적인 통합, 지속적인 서비스 muyeon95.tistory.com https://overjoyed-sailfish-366.notion.site/CI-CD-db415d8512e94125930fe71cb0b73091?pvs=4 CI/CD 참조 링크 overjoyed-sailfish-366.notion.site Github Action : https://muyeon95.tistory.com/22..
2023.07.23 -
에러처리 미들웨어 [ express ] [ node.js ]
다른 미들웨어 함수와 동일한 방법으로 오류 처리 미들웨어 함수를 정의할 수 있지만, 오류 처리 함수는 3개가 아닌 4개의 인수, 즉 (err. req. res, next) 를 갖는다는 점이 다르다. 오류 처리 미들웨어는 다른 app.use() 및 라우트 호출을 정의한 후에 마지막으로 정의해야 하며, 예를 들면 다음과 같다. // app.js // ... // 에러 핸들링 미들웨어 정의 app.use((err, req, res, next) => { const status = err.statusCode || 500; const errorMessage = err.message || "서버 에러"; res.status(status).json({ errorMessage, }); }); // ... 미들웨어 함수 ..
2023.07.22