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

@cub/cub

v1.0.0-alpha.0

Published

a web framework for fibjs

Downloads

21

Readme

@cub/cub

NPM version build status Test coverage David deps Known Vulnerabilities npm download

a web framework for fibjs

Install

$ npm i @cub/cub --save

Quick Start

const Cub = require('@cub/cub');

const cub = new Cub();

cub.register(ctx => {
  ctx.body = 'Hello World!';
});

cub.listen(8000);

Usage

  • multi-register

Register function can be invoked many times to accept interceptor. All these registered interceptors will be executed one by one.

cub.register(ctx => {
  ctx.body = 'Hello';
});

cub.register(ctx => {
  ctx.body += ' World!';
});
  • stop execute register

If you want to stop running the flowing interceptor, just return false(only false accept) in the current interceptor.

cub.register(ctx => {
  ctx.body = 'Hello ';
  return false; // only `false` accept
});

cub.register(ctx => {
  ctx.body += ' World!';
});
  • If you want to execute some logic after the last interceptor has been invoked like koa design, you register a an instance of BaseInterceptor.
const BaseInterceptor = Cub.BaseInterceptor;

cub.register(new class extends BaseInterceptor {
  before (ctx){
    ctx.body = 'Hello';
  }

  after (ctx){
    ctx.body += ' World!';
  }
});

API

todo

Benchmark

Cub :

➜  ~ wrk -c100 -t10  -d5  --latency  http://127.0.0.1:8000
Running 5s test @ http://127.0.0.1:8000
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     1.91ms    4.09ms  55.16ms   97.72%
    Req/Sec     7.11k     1.09k   15.14k    93.07%
  Latency Distribution
     50%    1.38ms
     75%    1.44ms
     90%    1.53ms
     99%   24.96ms
  357495 requests in 5.10s, 41.93MB read
Requests/sec:  70060.74
Transfer/sec:      8.22MB

Koa@2 with Node.js 7.10.0:

➜  ~ wrk -c100 -t10  -d5  --latency  http://127.0.0.1:8000
Running 5s test @ http://127.0.0.1:8000
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     6.51ms    1.09ms  20.98ms   91.32%
    Req/Sec     1.54k   581.07    14.30k    99.80%
  Latency Distribution
     50%    6.40ms
     75%    6.84ms
     90%    7.33ms
     99%    9.78ms
  76959 requests in 5.10s, 10.94MB read
Requests/sec:  15093.17
Transfer/sec:      2.14MB

express@4 with Node.js 7.10.0:

➜  ~ wrk -c100 -t10  -d5  --latency  http://127.0.0.1:8000
Running 5s test @ http://127.0.0.1:8000
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     9.13ms  769.26us  16.17ms   82.08%
    Req/Sec     1.10k    61.17     1.21k    74.20%
  Latency Distribution
     50%    8.94ms
     75%    9.38ms
     90%   10.05ms
     99%   11.95ms
  54787 requests in 5.02s, 11.23MB read
Requests/sec:  10920.82
Transfer/sec:      2.24MB

Questions & Suggestions

Please open an issue here.

License

MIT