1.0.1 • Published 10 months ago

@waveorb/static v1.0.1

Weekly downloads
-
License
-
Repository
github
Last release
10 months ago

Waveorb static

Node web static files server with built in compression support.

Install

npm i @waveorb/static

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 static = require('@waveorb/static')

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

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

server.listen(3000)

Created by Eldøy Projects

1.0.1

10 months ago

1.0.0

10 months ago