Created
June 8, 2021 14:26
-
-
Save teasmade/0d167c68a66eed9f4ecdbbb56b7b4183 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('request'); | |
request('https://swapi.dev/api/people/1/', function (error, response, body) { | |
// console.error('error:', error); // Print the error if one occurred | |
// console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received | |
// console.log('body:', body); // Print the body | |
let luke = JSON.parse(body); | |
console.log(luke); | |
console.log(luke.films); | |
request('http://swapi.dev/api/films/1/', function (errorF, responseF, bodyF) { | |
let film = JSON.parse(bodyF); | |
console.log(film.title); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment