@mousepox/static-server
v0.1.0
Published
A dead simple, zero-dependency static file server for Node.js.
Downloads
2
Readme
@mousepox/static-server
A dead simple, zero-dependency static file server for Node.js.
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");