how to send get request to external server using node
const https = require('https');
https.get('https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY', (resp) => {
let data = '';
// A chunk of data has been recieved.
resp.on('data', (chunk) => {
data += chunk;
});
// The whole response has been received. Print out the result.
resp.on('end', () => {
console.log(JSON.parse(data).explanation);
});
}).on("error", (err) => {
console.log("Error: " + err.message);
});
Also in JavaScript:
- modal reactjs template
- angular in memory web api login curd exmpal
- mongoose
- if statement javascript one line ?
- responsive grid system angular
- how can we take selected index value of dropdown in javascript
- call local function javascript
- jQuery - Get Content and Attributes
- javascript format rupiah
- javascript sort chars in string
- how to make a circle in js
- vue js getter
- jquery datepicker set year range
- google maps js remove google maps logo
- v-for vuejs
- stripe stripe js
- how sent data to dilaog angular material
- how to host a react website
- html select specify deafult select by js variable
- angular send data to parent component
- js data object length
- math.min
- upload image ajax demo
- nodemon : The term 'nodemon' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + nodemon index