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 ๐Ÿ™

ยฉ 2024 โ€“ย Pkg Stats / Ryan Hefner

volleyball

v1.5.1

Published

๐Ÿ Tiny HTTP logger for Express showing asynchronous requests and responses

Downloads

2,252

Readme

๐Ÿ Volleyball

npm version Build Status Greenkeeper badge code style: prettier

Small Express HTTP logger for debugging asynchronous requests and responses

const app = require('express')()
const volleyball = require('volleyball')

app.use(volleyball)

Screenshot

Volleyball is a minimal Connect-style middleware function which logs incoming requests and outgoing responses as separate events. It optionally supports the debug module.

Motivation

Logging HTTP cycles can be approached in several ways, each with its own drawbacks:

  • Log only upon request. Drawback: we cannot log the corresponding response, which happens later (if at all).
  • Log only upon response, attaching the request. Drawback A: if the server never sends a response, e.g. due to a bug, the request will not be logged either. Drawback B: two temporally distinct events are conflated, misleadingly.
  • Log both upon request and response. Drawback: it is not necessarily clear which responses are for which requests.

Volleyball takes the last approach, and assigns randomly-generated ids to label request-response pairs. It is designed for student project development, teaching beginning programmers how HTTP servers and asynchronicity work. It may also be useful as a low-configuration debug tool.

Usage

volleyball

The volleyball module can be used directly as demonstrated in the first example. The module defaults to using process.stdout for output.

volleyball.custom(config)

A customized logging middleware can be generated by calling custom with a configuration object:

const logger = volleyball.custom({ debug: true }) // default namespace 'http'
// const logger = volleyball.custom({ debug: 'custom-namespace' })
// const logger = volleyball.custom({ debug: debugInstance })

app.use(logger)

The debug property logs using the debug module. It supports the following values:

| value | result | | -------- | ------------------------------------------------------------------------------------------------------------------------ | | true | uses a new debug instance with a default namespace of 'http' | | string | uses a new debug instance with a custom namespace | | function | uses any function, such as a pre-generated debug instance. Note that the function will be called with colorized strings. |

Related and Alternatives

For more powerful, configurable, and compatible logging needs, check out: