Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

nodejs http get request to external server

const request = require("request");
const url = "<a href="https://my-json-server.typicode.com/edurekaDemo/noderequest/db">https://my-json-server.typicode.com/edurekaDemo/noderequest/db</a>";
request.get(url, (error, response, body) => {
let json = JSON.parse(body);
console.log(body);
});
Comment

make get request to external server node Request

//TERMINAL npm install request@2.81.0

const request = require('request');

request('https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY', { json: true }, (err, res, body) => {
  if (err) { return console.log(err); }
  console.log(body.url);
  console.log(body.explanation);
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: onpress setstate react native 
Javascript :: Odoo Plain Javascript files 
Javascript :: react increment multipying button click 
Javascript :: electron js nodeintegration 
Javascript :: window.scrollTo Id sample code 
Javascript :: rerender a vue component 
Javascript :: server side rendering in agular 
Javascript :: javascript if not 
Javascript :: string remove last two characters javascript 
Javascript :: foreach loop in nodejs 
Javascript :: react js typescript doc data is possibly undefined 
Javascript :: javascript array filter elements greater than 
Javascript :: nevigate on button click in angular 
Javascript :: what does document.getelementbyid return 
Javascript :: fizzbuzz javascript 
Javascript :: volume slider javascript 
Javascript :: react native vector icons link 
Javascript :: test window.location.reload() jest 
Javascript :: how to use empty href link in reactjs 
Javascript :: react component will mount new method 
Javascript :: how to get current formatted date dd/mm/yyyy in javascript 
Javascript :: post request with headers 
Javascript :: uint8array javascript 
Javascript :: yarn add node-sass webpacker error rails 
Javascript :: jquery close 
Javascript :: javascript template literals html 
Javascript :: get static props 
Javascript :: How to Display a List in React 
Javascript :: how to select an element in javascript 
Javascript :: react js alert popup example 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =