미채택 완료

nodejs 에서 api 호출

2018-05-31 (목) 17:06:56 3,087

리눅스 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를 찾을수 없다고 나오네요..

|

답변 1개

2018-05-31 (목) 17:57:28

ssl 떄문인것 같습니다.

답변을 작성하려면 로그인이 필요합니다.