Created
July 27, 2018 00:27
-
-
Save CreatiCoding/899346e111cfb163f84a43972bbf7a94 to your computer and use it in GitHub Desktop.
[Node.js] request with promise
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
const request = require('request'); | |
new Promise((resolve, reject)=>{ | |
console.log(1); | |
resolve(new Promise((resolve, reject)=>{ | |
request({url:'http://www.naver.com'},()=>{ | |
console.log(2); | |
resolve(3); | |
}); | |
})); | |
}).then(data=>{ | |
console.log(data); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output