@waveorb/static
v1.0.1
Published
Node static file web server
Downloads
165
Readme
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