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 🙏

© 2025 – Pkg Stats / Ryan Hefner

route99

v0.1.0

Published

NodeJS route manager for API RESTful

Readme

Route99

The Route99 was developed to be simple. It is a server and route manager to create API Restful services.

Install

npm install route99 --save

Example

Route99 was developed to be modular. So, each registered route can be a module.

// File: routes/client.js
module.exports = function(app) {
  // GET /
  app.get('/', function(req, res) {
    res.send({
      'ip': '127.0.0.1',
      'userAgent': 'Firefox 40'
    });
  });
}

// File: routes/status.js
module.exports = function(app) {
  // GET /
  app.get('/', function(req, res) {
    var memory = getMemoryUsage();
    var cpu = getCpuUsage();

    res.send({
      memory: memory,
      cpu: cpu
    });
  });

  // GET /memory
  app.get('/memory', function(req, res) {
    res.send(getMemoryUsage());
  });

  // GET /cpu
  app.get('/cpu', function(req, res) {
    res.send(getCpuUsage());
  });
}

// File: app.js
var Route99 = require('route99');
var app = new Route99();

// GET /client
app.register('client', require('routes/client'));

// GET /status[/memory, /cpu]
app.register('status', require('routes/status'));

// Start server
app.listen({
  port: 8080,
  charset: 'utf-8',
  timeout: 30 * 1000 // 30s
});

API

use

Register plugins to be executed for each request.

var Route99 = require('route99');
var app = new Route99();

app.use(function serverName(req, res, next) {
  res.setHeader('X-Powered-By', 'route99');
  next();
});

notFound

Register not found error.

var Route99 = require('route99');
var app = new Route99();

app.use(function serverName(req, res) {
  res.writeHead(404, {'Content-Type': 'text/json'});
  res.end({ code: 404, success: false, error: true });
});

before

Code to be executed before each request in specific route.

module.exports = function(app) {
  app.before(function(done) {
    if(isNotConnectedInDatabase === true) {
      connectDatabaseSync();
    }
    done();
  });

  app.get('/', rootPath);
}

expose

Use expose to register persistent data to be exposed to your route module.

module.exports = function(app) {
  app.before(function(done) {
    app.expose('foo', {'bar': true});
    done();
  });

  app.get('/', function(req, res) {
    // exposed data can be read in `env` object
    res.send(app.env.foo);
  });
}

To Do / Issues

HTTP Methods

  • [x] GET
  • [ ] POST
  • [ ] PUT
  • [ ] DELETE

Improve

  • [ ] Tests

Know issues

  • [ ] api before do not receive req and res objects.