Created
January 9, 2016 11:46
-
-
Save Spaxe/546934d71ca3232310b7 to your computer and use it in GitHub Desktop.
Search on wikipedia
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 wikipedia = require("node-wikipedia"); | |
const searchWiki = (term) => { | |
return new Promise( (resolve, reject) => { | |
wikipedia.page.data(term, { content: true }, (response) => { | |
if (!response) reject(null); | |
resolve(response); | |
}); | |
}); | |
}; | |
// Example usage | |
searchWiki("Cat").then{ result => { | |
console.log(result); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment