smor

0.1.1 • Public • Published

Smør

Node web static files server with built in compression support.

Install

npm i smor

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.

var http = require('http')
var smor = require('smor')

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

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

server.listen(3000)

MIT licensed. Enjoy!

Created by Eldøy Projects

Package Sidebar

Install

npm i smor

Weekly Downloads

5

Version

0.1.1

License

MIT

Unpacked Size

5.82 kB

Total Files

3

Last publish

Collaborators

  • eldoy