Last active
January 19, 2019 20:34
-
-
Save parzibyte/40d7f2a8b6155f7def1d4d03da92ff63 to your computer and use it in GitHub Desktop.
Petición HTTP GET con Node.JS y request created by parzibyte - https://repl.it/@parzibyte/Peticion-HTTP-GET-con-NodeJS-y-request
This file contains 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
/** | |
* Simple ejemplo de petición GET HTTP con | |
* Node.js y el módulo request | |
* | |
* @author parzibyte | |
*/ | |
const request = require("request-promise"), | |
RUTA = "https://jsonplaceholder.typicode.com/users"; | |
request({ | |
uri: RUTA, | |
json: true, // Para que lo decodifique automáticamente | |
}).then(usuarios => { | |
usuarios.forEach(usuario => { | |
console.log(`Tenemos a un usuario llamado ${usuario.name} con correo ${usuario.email}`); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment