1.1.2 • Published 2 years ago
dnjokes-api-wrapper v1.1.2
:notebook_with_decorative_cover: Table of Contents
:star2: About the Project
:space_invader: Tech Stack
:toolbox: Getting Started
:gear: Installation
Install DNJokes-API Wrapper with npm
npm i dnjokes-api-wrapper
or with yarn
yarn add dnjokes-api-wrapper
or use as an inline script with a CDN
<script src="https://cdn.jsdelivr.net/npm/dnjokes-api-wrapper/lib/cjs/index.min.js"></script>
:eyes: Usage
To use the wrapper, you need to import it into your project.
ESM Module
import getAllDNJokes from 'DNJokes-API-Wrapper';
getAllDNJokes().then((res) => {
console.log(res);
});
CommonJS
const DNJokes = require('DNJokes-API-Wrapper');
DNJokes.getAllDNJokes().then((res) => {
console.log(res);
});
:triangular_flag_on_post: Commands
These are the commands you can use with the wrapper
// Get an array of all jokes in the database
getAllDNJokes(max_results: number); // putting a value in the function will define the maximum number of jokes to return
// Get a random joke from the database
getRandomDNJoke();
// Get a joke by ID
getDNJokeById(dn_id: number); // put the ID of the joke you want to get in the function
// Get a joke by search query
getDNJokeByQuery(keyword: string); // put the search query in the function
:test_tube: Running Tests
To run tests, run the following command
npm test
:wave: Contributing
Contributions are always welcome! Open an issue with any issues or requests!
:warning: License
Distributed under the MIT License. See LICENSE.md
for more information.
:handshake: Contact
devious@deviouslab.dev deviouslab.dev