Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
A nodejs module for getting trivia questions in all your fancy projects, in a pretty simple way.
A Node.JS module for getting trivia questions in all your fancy projects, in a pretty simple way.
Promise.<Object>
Returs the available categories of the trivia questions.
Promise.<Object>
Returs a trivia question from the given options.
Param | Type | Optional | Description |
---|---|---|---|
[options] | Object | True | The options for Trivia API |
[options.encoding] | String | True | The encoding format of the result, either urlLegacy , url3986 and base64 . |
Example
const Trivia = require('trivia-api')
const trivia = new Trivia({ encoding: 'url3986' });
Promise.<Object>
Returs the available categories of the trivia questions.
Kind: global function
Returns: Promise.<Object>
- Resolves available trivia categories and their IDs
Example
trivia.getCategories()
.then(console.log)
.catch(console.error);
Promise.<Object>
Returs a trivia question from the given options.
Kind: global function
Returns: Promise.<Object>
- Resolves available trivia questions
Param | Type | Optional | Default | Description |
---|---|---|---|---|
[options] | Object | True | The options for retrieving the question | |
[options.amount] | String | True | 1 | The amount of question(s) to be retrieved |
[options.difficulty] | String | True | The difficulty of question(s) to be retrieved, either easy , medium or hard | |
[options.category] | Number | True | The category ID from which the question(s) should be retrieved | |
[options.type] | String | True | The type of question(s) to be retrieved, either multiple or boolean |
Example
let options = {
type: 'boolean',
amount: 10,
difficulty: 'hard'
};
trivia.getQuestions(options)
.then(questions => console.log(questions))
.catch(console.error);
If you liked this project you can ⭐ Star it on GitHub and/or send a thank you note to me.
FAQs
A nodejs module for getting trivia questions in all your fancy projects, in a pretty simple way.
The npm package trivia-api receives a total of 20 weekly downloads. As such, trivia-api popularity was classified as not popular.
We found that trivia-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.