Answer the question
In order to leave comments, you need to log in
Get NodeJS request?
I send a get request to localhost:3000/ using the server, I get a JSON file, how do I accept it and work with it?
Answer the question
In order to leave comments, you need to log in
More or less like this.
const url = ' http://...';
http.get(url,(res)=>{
let body = '';
res.on('data',(elem) => body +=elem);
res.on('end',()=> console.log(JSON.parse(body));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question