Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

static-handler

WebReflection1.6kISC0.5.3

A very simple static files handler

static, handler, server

readme

static-handler

A very simple static files handler, useful for testing, debugging purpose, or whenever a very basic static file server is needed as fallback/resource.

# as CLI
npx static-handler --help
// as utility
const staticHandler = require('static-handler');

const handled = staticHandler(__dirname);

require('http').createServer((req, res) => {
  // handled as static content, returns true
  if (handled(req, res))
    return;

  // do anything else
}).listen(8080);