Random funny dadjokes fetcher
To get started with jokify
, simply run the following command in your terminal:
npm installation command:
$ npm i jokify
yarn installation command:
$ yarn add jokify
First, require this library to your project as follows:
const jokify = require("jokify");
If it's an ES Module then import it to your project as follows:
import jokify from "jokify";
New to Promises?
If you're not familiar with promises, check out the MDN documentation to learn more.
Once you've imported jokify
into your project, you're ready to fetch your first funny dadjoke.
Here's a simple example to get you started:
// Import the 'JokifyClient' class
const { JokifyClient } = require("jokify");
// Create a new instance of 'JokifyClient' class
const client = new JokifyClient();
// Call the fetchJoke() method
client.fetchJoke()
.then(result => {
// Log the result
console.log(result);
// Result object contains:
// - joke
// - id
// - status
})
.catch(error => {
// Handle any error(s) which occur
console.error(error);
})
jokify
is released under the MIT License.
View the full license terms here.
Found a bug or want a new feature?
Report issues and request features on the jokify issue tracker.
Thanks for reading!
Have a great day ahead :D