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

super_framework

v1.0.0

Published

A remarkably super framework.

Readme

super_framework

Build Status

A simple HTTP server framework, including basic router with response methods, a directory reader, and a request counter.

Table of Contents

  • Router constructor
  • respond(res, data)
  • sendFile(filename, res)
  • writeDirectory(filepath, method)
  • Request Counter
  • Example Implementation

Router

A basic REST request router. To implement, require in super_framework as a new router constructor.


var router = new Router();```

# respond(res, data)

Sends a simple 'OK' HTTP response. User provides response object and data to write.

Example:

`Router.respond(res, 'hello world!');    // writes 'hello world!' to response object.`

# sendFile(filename, res)

The send file function is used for sending back a file, the header, and the response.

How to use it:

`router.sendFile(filepath, res);`

NOTE: filepath MUST include root directory (see example below);

# writeDirectory(router, filepath, method)

Reads all files in a directory and assigns a response to them.

The writeDirectory function takes two arguments: the filepath of the directory
to read, and the REST method to call on it. writeDirectory will register all
files as properties of the appropriate method, and assign the appropriate
response function. At this time writeDirectory only assigns responses to GET
requests. NOTE: Filepath MUST include root directory (see example below)

Example:

`Router.writeDirectory('/directory', 'GET');    // returns all files in directory on request`

# Request Counter

Counters for requests are designed for tracking user's activity.
Counter is a number. It shows how many times particular url has been requested.
How to use it:

1. Creating new instance of Route object:

  `var route = new Route();`

2. Creating routes:

  ```router.get('/first', function(req, res){
    respond(res, "It's the first route")
  });
  router.get('/second', function(req, res){
   respond(res, "It's the second route")
  });```

3. Creating the route which is responsible for counters:

  ```router.get('/count', function(req, res) {
  router.stat(req, res);
 })```

'stat' is built-in method of Router object. It needs to be used in order to
receive statistic information. In this example 'count' request will give
statistics for user's requests.

------------------------------------------

# Example Implementation

```'use strict';

var http = require('http');
var Router = require(__dirname + '/../index.js');

var router = new Router();

router.writeDirectory('/test/testDirectory', 'GET');

router.get('/', function(req, res) {
router.routes['GET']['/test/testDirectory/test2/home.html'](req, res);
});

router.get('/test', function(req, res){
router.respond(res, 'hello, world!');
});

router.get('/test2', function(req, res) {
router.sendFile('test/testDirectory/boo.html', res);
});

router.get('/stat', function(req, res) {
router.stat(req, res);
});

var server = http.createServer(function(req, res) {
router.route(req, res);
}).listen(3000, function() {
console.log('server listening on port 3000');
});```