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

httpe

v0.9.0

Published

An http & https compatible module. Simultanious ports & protocols. Set & generate certificates & charsets & mimetypes. Glob & chain requests. Stream & process files.

Readme

httpe

NPM Version Build Status Support Chat

httpe is a fully http & https compatible module that can support simultanious ports & protocols, set or generate SSL certificates & charsets & mimetypes, glob & chain requests, stream & process files, and more.

npm install httpe
const httpe = require('httpe');

// immediately start an http/https server on ports 80/443
httpe.createServer({ listen: true }).use(
  'GET:80 /',
  // homepage: show a custom message
  (req, res) => res.send('A request for the root on port 80 using the GET method')
).use(
  '*.js',
  // js: show a confusing message
  (req, res) => res.sendJS(`eval does a body good`)
).use(
  // json: show a confusing message
  '*.json',
  (req, res) => res.sendJSON({ message: 'eval does a body good' })
).use(
  // anything else: show the method, port, and URL of the request
  (req, res) => res.send(`${req.method}:${req.connection.server.port} ${req.pathname}`)
).listen(server => {
  console.log(
    `httpe is listening…\n` +
    `--------------------------------------\n` +
    `   Local: ${server.port.map(port => `http://localhost:${port}/`).join('\n          ')}\n` +
    `External: ${server.port.map(port => `http://${httpe.ip}:${port}/`).join('\n          ')}\n` +
    `--------------------------------------`
  );
});

httpe is backwards-compatible with the http module.

const httpe = require('httpe');

httpe.createServer((req, res) => {
  // do something with the request
}).listen();

Additional Features

The createServer method returns a new instance of a Server. The listen property instructs the server to immediately begin, and giving it a number defines the port.

server = httpe.createServer({ port: 8080 });
server = httpe.createServer({ port: [80, 443] });

The useAvailablePort property instructs the server to use the first available port only if the specified port is not available.

server = httpe.createServer({ listen: 8080, useAvailablePort: true });

Additional Request Features

The request object is identical to http.IncomingMessage with the addition of properties available to an URL.

request.pathname; // the pathname does not include search params

The request.includes function returns whether a search pattern matches the current request.

The path may contain a method, port, and pathname with globs.

server.request((req, res) => {
  if (req.includes('GET:80 /')) {
    // runs whenever the root is requested on port 80 using the GET method
  }

  if (req.includes(':80 /')) {
    // runs whenever the root is requested on port 80 using any method
  }

  if (req.includes('/')) {
    // runs whenever the root is requested on any port using any method
  }

  if (req.includes('GET /')) {
    // runs whenever the root is requested on any port using the GET method
  }

  if (req.includes('GET')) {
    // runs whenever any path is requested on any port using the GET method
  }

  if (req.includes(':80|443')) {
    // runs whenever any path is requested on port 80 or 443 using any method
  }

  if (req.includes('*.js')) {
    // runs whenever any path ending in .js is requested on any port using any method
  }

  if (req.includes('/**/*')) {
    // runs whenever a subdir path of any depth is requested on any port using any method
  }
});

The request.charset property returns the default character set for the requested pathname. The request.contentType property returns the default content type for the requested pathname. The request.mimeType property returns the default mime type for the requested pathname.

// If the request.pathname is `/script.js`
request.charset; // returns 'UTF-8'
request.contentType; // returns 'application/javascript; charset=utf-8'
request.mimeType; // returns 'application/javascript'

Additional Response Features

The response is identical to http.ServerResponse with the addition of the following chainable properties.

The send function sends an HTTP response body and ends the response. When the parameter is a Buffer, the Content-Type is set to application/octet-stream, and when it is a String, the Content-Type is set to text/html, and when the parameter is an Array or Object, the Content-Type is set to text/json.

res.send('<p>some html</p>');

The sendHTML, sendJS, sendJSON, and sendCSS functions handle send specific kinds of responses.

res.sendHTML('<p>some html</p>');

A status code and headers may also be specified.

res.send(404, 'Sorry, we cannot find that!');

res.send({
  status: 404,
  headers: { 'Content-Type': 'text/html' }
}, 'Sorry, we cannot find that!');

The redirect function redirects to a new URL. A status code may also be specified.

response.redirect('/foo/bar'); // 302

response.redirect(301, 'http://example.com'); // 301

The setHeaders function sets HTTP response headers, and multiple fields may be specified at once.

response.setHeaders('Content-Type', 'text/plain');

response.setHeaders({
  'Content-Type': 'text/plain',
  'Content-Length': 123
});

The sendFile function transfers a file, setting HTTP headers based on the filename’s extension, size, and modified time.

res.sendFile('path/to/file', { from: 'some/dir' });