코드스테이츠 블록체인 교육 - 15일(7/27)

Imomo·2022년 8월 3일
0

블록체인교육

목록 보기
15/26

📚 fs.readFile(path[,options], callback)

비동기적으로 파일 내용 전체를 읽습니다. 이 메소드를 실행할 때에는 인자 세 개를 넘길 수 있다.

✅ fs 예제

fs.readFile('test.txt', 'utf8', (err,data) => {
	if(err) {
    	throw err;
    }
  console.log(data);
});

📚 fetch를 이용한 네트워크 요청

  • URL로 요청하는 걸 가능하게 해주는 API

✅ fetch 예제

let url = "https://v1.nocodeapi.com..."
fetch(url)
	.then((response) => response.json())
	.then((json) => console.log(json))
	.catch((error) => console.log(error));

0개의 댓글