Skip to content

anaskhan96/consolia-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

consolia-api

Build Status npm version

consolia-api is an npm module (with a command line utility) for fetching comics from consolia-comic.com.

Installation

npm install --save consolia-api

Usage

The package has two functions, archive (fetches all the comics), and load (fetches either the latest, random or id specified comic).

var consolia = require('consolia-api');

// fetching all the comics
consolia.archive(function (data, err) {
	if (err != null)
		console.log(err);
	else
		console.log(data);
});

// fetching by the latest comic
consolia.load('latest', function (data, err) {
	// ---write your code---
});

// fetching any random comic
consolia.load('random', function (data, err) {
	// ---write your code---
});

// fetching by id
consolia.load(85, function (data, err) {
	// ---write your code---
});

load returns a JSON containing the data, while archive returns an array of all the JSONs. Example of one such comic returned:

{ 
    title: 'Trust in software',
    image: 'https://static.consolia-comic.com/comics/trust.png',
    tooltip: 'I also don\'t trust the servers we host it on.',
    id: 118,
    posted_on: '2017-05-22',
    slug: 'trust',
    sublog: 'There are two kinds of developers in this world. Those who don\'t trust software, and those other devs who also do not trust software.'
}

Command Line

consolia-api can also be installed globally to fetch comics right in the terminal.

npm install -g consolia-api

The following commands can be run :

Usage Details:

consolia [ latest | random | <id> ]

About

npm module to fetch consolia comics

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published