New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

trivia

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trivia

Generate random trivia questions

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Trivia

A simple wrapper around the Mashape Trivia API

This package utilizes this API to provide access to tens of thousands of trivia questions. In order to use it, you must obtain an API key from mashape here.

Installation

$ npm install trivia --save

Usage

var trivia = require('trivia')(YOUR_MASHAPE_KEY);

//Get questions for a specific category
trivia.questions({
  limit: 10,
  page: 3,
  categoryId: 50
}, function(err, questions) {
  console.log(questions);
});

//Page through all questions in the database
trivia.questions({
  limit: 10,
  page: 1
}, function(err, questions) {
  console.log(questions);
});

//List all categories
trivia.categories({
  limit: 10,
  page: 2
}, function(err, categories) {
  console.log(categories);
});

//Get a random question from the database
trivia.random({
  limit: 10,
  page: 4
}, function(err, random) {
  console.log(random);
});

//Total number of questions in the system
trivia.count({
  limit: 10,
  page: 4
}, function(err, count) {
  console.log(count);
});

License

MIT (See LICENSE for more info)

Keywords

Triva

FAQs

Package last updated on 25 Sep 2015

Did you know?

Socket

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.

Install

Related posts