0.1.0 • Published 6 years ago

@mousepox/static-server v0.1.0

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

@mousepox/static-server

A dead simple, zero-dependency static file server for Node.js.

Actions Status

Quick Start

import { StaticServer } from "@mousepox/static-server";

// Create server from a path to static resources
const server = new StaticServer("path/to/static/resources");

// Start listening
server.listen(8081);

MIME Types

Content types are inferred from file extensions. By default, common extensions are mapped to their appropriate MIME types. For example, .js => text/javascript.

However, custom mappings can be set using the setMIMEType method:

server.setMIMEType(".xml", "application/xml");