static-handler

0.5.3 • Public • Published

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);

Readme

Keywords

Package Sidebar

Install

npm i static-handler

Weekly Downloads

164

Version

0.5.3

License

ISC

Unpacked Size

61.1 kB

Total Files

9

Last publish

Collaborators

  • webreflection