0
"request"npm을 사용하여 POST, PUT, Get 및 Delete 요청을 내 API로 보냅니다.본문에서 특정 데이터 값을 가져 오는 방법은 무엇입니까?
본문의 특정 데이터 값을 얻으려면 어떻게해야합니까?
예 : 나는 _id의 값을 취득하고 모두 undefined
를 반환은
body: '{"_id":"58332517c4afbd230074732e","PushToken":"1","AuthCode":"1","DeviceID":"1"}'
내 현재의 GET 요청이
request.get('http://localhost:3000/api/pass/58332517c4afbd230074732e', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body._id);
console.log(response.body._id);
}
});
나는 모두 시도
, body._id
및 response.body._id
이다 저장할.