
Security News
High Salaries No Longer Enough to Attract Top Cybersecurity Talent
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
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
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.