hangersteak

0.2.12 • Public • Published

Hangersteak

Node web static files server with built in compression support.

INSTALL

npm i hangersteak

USAGE

Vanilla NodeJS server. Will return 404 if not found, or the file using streams and correct mime type. Supports automatic 304 last modified headers.

const http = require('http')
const hangersteak = require('hangersteak')

const server = http.createServer((req, res) => {
  // Using default options
  hangersteak(req, res)

  // With options, default values shown
  hangersteak(req, res, {
    dir: '', // Start with '/' to use absolute path
    maxAge: 3600,
    indexFile: 'index.html',
    compress: false
  })
})

server.listen(3000)

MIT licensed. Enjoy!

Package Sidebar

Install

npm i hangersteak

Weekly Downloads

21

Version

0.2.12

License

MIT

Unpacked Size

5.89 kB

Total Files

3

Last publish

Collaborators

  • eldoy