nodejs 에서 api 호출
본문
리눅스 shell에서
npm install node-fetch한다음
js 에서 아래처럼 하면 되는거 아닌가요?
const fetch = require('node-fetch');
var sendData = {json}
fetch('https://주소/api/apiName', { method: 'POST', body: sendData })
.then(res => res.json())
.then(json => console.log(json));
오류는 node-fetch를 찾을수 없다고 나오네요..
답변을 작성하시기 전에 로그인 해주세요.