728x90
반응형
SMALL
express, fs, fs를 프로미스로 임포트
fs.readFile -> 같은경로에 file1.txt파일을 읽어서 에러가 나온다면 404 아니면 data return
file2 경로에서는 try문 안에서 file2.txt를 읽어서 오류처리 catch로
file3경로로 들어가게되면
promise로 불러온fs모듈로 file3을 읽고 오류처리
async, await로 오류처리
500번 status에 메시지를 추가하여 오류처리
728x90
반응형
LIST
'JavaScript > Node.js' 카테고리의 다른 글
Node.js - public (0) | 2023.05.02 |
---|---|
Node.js - routing (0) | 2023.05.02 |
Node.js - post (0) | 2023.05.02 |
Node.js - get (0) | 2023.04.24 |
Node.js - express (0) | 2023.04.24 |