Reputation: 8841
I am getting a reference error because I cannot use XMLHttpRequest.
Is there a way to make a get http request to grab all the data from my mongodb?
GET from http://localhost:3000/api/v1/posts
?
Upvotes: 0
Views: 197
Reputation: 1505
You can try using this package https://www.npmjs.com/package/request
var request = require('request');
request('http://www.google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) // Show the HTML for the Google homepage.
}
})
Upvotes: 4