try/catch

·[NodeJS] 노드
express-asyns-handler란?: Express.js 경로 핸들러 내에서 비동기 작업 처리를 단순화하는 미들웨어→ 명시적인 try/catch 블록 없이도 비동기 처리 를 작성할 수 있다.   설치법npm install express-async-handler   코드예시// @desc Get all contacts// @route GET /contactsconst getAllContacts = async (req, res) => { try{ res.status(200).send("Contacts Page"); } catch (error){ res.send(error.message); }});module.exports = getAllContacts;const asyncHandler ..
마지의하루
'try/catch' 태그의 글 목록