npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

apiize

v0.1.2

Published

Turn any json file into a full, explorable, REST API

Downloads

28

Readme

apiize NPM version Build Status Dependency Status Coverage percentage

Turn any JSON file into a full, explorable, REST API.

Presentation

Start apiize on a JSON file or url

cli-demo

And make requests on it

cli-demo

Install

$ npm install -g apiize

Command line usage

  • Start a new server on a given JSON file or url
$ apiize 'https://raw.githubusercontent.com/lambda2/apiize/master/test/datasets/punchlines.json'

  ___        _ _
 / _ \      (_|_)
/ /_\ \_ __  _ _ _______
|  _  | '_ \| | |_  / _ \
| | | | |_) | | |/ /  __/
\_| |_/ .__/|_|_/___\___|
      | |
      |_|

💫  Express has taken the stage and is listening on port 1313

∙ GET /api/contents Return all the contents
∙ GET /api/contents/:id Return the given contents
∙ GET /api/tags Return all the tags
∙ GET /api/tags/:id Return the given tags
∙ GET /api/authors Return all the authors
∙ GET /api/authors/:id Return the given authors
∙ GET /api/albums Return all the albums
∙ GET /api/albums/:id Return the given albums
∙ GET /api/titles Return all the titles
∙ GET /api/titles/:id Return the given titles
∙ GET /api/ Return all items
∙ GET /api/random A random item
  • Make requests on it
$ curl -H "Accept: application/json" "localhost:1313/"

{"endpoints":[{"url":"/api/contents","description":"Return all the contents"},{"url":"/api/contents/:id","description":"Return the given contents"},{"url":"/api/tags","description":"Return all the tags"},{"url":"/api/tags/:id","description":"Return the given tags"},{"url":"/api/authors","description":"Return all the authors"},{"url":"/api/authors/:id","description":"Return the given authors"},{"url":"/api/albums","description":"Return all the albums"},{"url":"/api/albums/:id","description":"Return the given albums"},{"url":"/api/titles","description":"Return all the titles"},{"url":"/api/titles/:id","description":"Return the given titles"},{"url":"/api/","description":"Return all items"},{"url":"/api/random","description":"A random item"}]}%

Usage

const Apiize = require('apiize');

// Here is the default options
const options = {
  verbose: false, // Output more verbose requests
  prefix: 'api', // The root endpoint of the API
  port: 1313 // The express server port.
};

// Turn the 'http://example.org/file.json' file into an API
let apiize = new Apiize('http://example.org/file.json', options);

// When apiize is ready
apiize.on('ready', function (server) {
  server.serve(); // run the server
});

API

var Apiize = require('apiize');

var api = new Apiize(link, options);

Events

ready

Triggered when the file or the link is fully loaded, and the express server is ready to be started.

var api = new Apiize(link, options);
api.on('ready', function (server) {
  server.serve(); // run the server
});

Methods

new Apiize(link, options)

Create a new Apiize object using the given link and options. The link argument must be a string of a JSON file or a JSON URL.

Apiize accepts these properties in the options object.

  • verbose

    Defaults to false, add a more verbose logging of incoming requests.

    • Without verbose: GET / 200 146 - 6.079 ms

    • With verbose: ::1 - - [25/Jun/2016:15:41:06 +0000] "GET / HTTP/1.1" 200 750 "-" "curl/7.43.0"

  • prefix

    Set the root path of the generated api routes. Defaults to api.

  • port

    Set the express server port. Defaults to 1313.

on(event, callback)

Triggered when an event is emmmited (e.g., the ready event).

serve()

Start the express server. Must be called when the ready event is called.


Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ npm test

People

André Aubin Andre's Gratipay

List of all contributors

License

MIT © Andre Aubin