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

msb-http2bus

v0.7.4

Published

An HTTP server providing endpoints for services exposed through the MSB bus.

Readme

msb-http2bus Build Status

An HTTP server providing endpoints for services exposed through the MSB bus.

Installation

$ npm install msb-http2bus

To run the server from the command line, globally install with option -g.

Server

Start a server with a static configuration file:

$ http2bus example/http2bus.json

Base configuration format, provided as either json or js:

{
  channelMonitorEnabled: true, // Default: true
  port: 8080, // Default: 0 (random port)
  routes: [
    { /* ... */ },
    { /* ... */ }
  ]
}

(All standard MSB environment variables should be provided for broker configuration.)

Routes

Routes are loaded as an array of configuration objects, always specifying an http section as well as either bus or provider section.

  • http Object An object required for all routes specifying HTTP behaviour.
  • http.path String An Express-style path to listen on.
  • http.basePath Optional URLs and redirects are relative to this path. (Default: '/')
  • http.methods Optional Array The HTTP methods to listen for, e.g. get, post, put, head. (Default: ['get'])
  • http.remote Optional Boolean Route all traffic below this path, for no specific HTTP methods, to a remote router. (Default: false)
  • http.cors Optional Object CORS middleware configuration options.
  • bus Object Must be a valid Requester configuration.
  • provider Object Dynamic routes can provided by this provider.
  • provider.name String The name corresponding to the Routes Agent.

Static Route Example

For routing GET requests similar to /api/v1/example/abc123?depth=10 to example:topic:

{
  http: {
    basePath: '/api/v1/examples',
    path: '/:example-id',
    methods: ['get']
  },
  bus: {
    namespace: 'example:topic',
    waitForResponses: 1
  }
}

The payload placed on example:topic would be similar to:

{
  "method": "get",
  "url": "/abc123",
  "headers": {
    "content-type": "application/json"
  },
  "params": {
    "example-id": "abc123"
  },
  "query": {
    "depth": "10"
  }
}

See this normal responder example.

Headers provided in the responder payload are sent in the HTTP response. E.g, for a redirect:

response.writeHead(301, {
  location: '/renamed-abc123'
})

If the location header, is not fully qualified, i.e. without protocol and domain name, it will be rewritten relative to this base path specified in the route, in this case /api/v1/examples/renamed-abc123.

Dynamic Routes Example

To route all requests below /api/v1/remotes using routes configurations provided by this routes agent.

{
  http: {
    basePath: '/api/v1/remotes'
  },
  provider: {
    name: 'remotes-example-api'
  }
}

The routes loaded by the corresponding Routes Agent will be published relative to the specified basePath.

Routes Agent

You can provide routes to http2bus servers from remote agents on the bus. An agent must be specified as a provider in a route on the server. Note: an agent does not actually process any requests, it only publishes routes to the servers.

For example:

var http2bus = require('msb-http2bus')

var agent = http2bus.routesAgent.create({
  name: 'remotes-example-api',
  ttl: 3600000
})

var routes = [{
  http: {
    path: '/:example-id',
    methods: ['get']
  },
  bus: {
    namespace: 'example:topic',
    waitForResponses: 1
  }
}]

agent
.start()
.load(routes)

The configuration format for routes are the same as on the http2bus server. You can dynamically change routes to be reloaded on all relevant http2bus servers:

agent.load([])

(All standard MSB environment variables should be provided for broker configuration.)

License

MIT