nodejs 에서 api 호출

nodejs 에서 api 호출

QA

nodejs 에서 api 호출

답변 1

본문

 

 

리눅스 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

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
filter #node ×
전체 10
© SIRSOFT
현재 페이지 제일 처음으로