@mousepox/static-server
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

@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");

Readme

Keywords

Package Sidebar

Install

npm i @mousepox/static-server

Weekly Downloads

0

Version

0.1.0

License

ISC

Unpacked Size

6.19 kB

Total Files

10

Last publish

Collaborators

  • richtaur
  • geoffblair