0.5.0 • Published 8 months ago

servitsy v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

servitsy

Small, local HTTP server for static files.

  • Small: no dependencies, 22 kilobytes gzipped.
  • Local: designed for local development workflows.
  • Static: serves files and directory listings.

Usage

npx servitsy [directory] [options]

!NOTE servitsy is a command-line tool, published as a npm package. It requires Node.js version 18 or higher, or a compatible runtime like Deno or Bun.

# Running with Bun
bunx servitsy

# Running with Deno (will prompt for read access)
deno run --allow-net --allow-sys npm:servitsy

Calling servitsy without options will:

  • serve the current directory at http://localhost:8080 (listening on hostname 0.0.0.0);
  • try the next port numbers if 8080 is not available;
  • serve index.html files for folders, and .html files when the extension was omitted in the URL;
  • serve directory listings (for folders without an index file).

Options

You can configure servitsy's behavior with options. For example:

# Serve current folder on port 3000, with CORS headers
npx servitsy -p 3000 --cors

# Serve 'dist' folder and disable directory listings
npx servitsy dist --no-list
  • Use npx servitsy --help for an overview of available options.
  • Read doc/options.md for details and examples.

Changelog

See doc/changelog.md for the release history.

License

This package is licensed under the MIT license.

Alternatives

!WARNING servitsy is not designed for production. There are safer and faster tools to serve a folder of static HTML to the public. See Apache, Nginx, @fastify/static, etc.

For local testing, here are a few established alternatives you may prefer, with their respective size:

PackageVersionDependenciesInstalled size†
servitsy0.5.00104 kB
servor4.0.20144 kB
sirv-cli3.0.012396 kB
serve14.2.4877.5 MB
http-server14.1.1529.4 MB

If size and dependency count is not a concern and you want something stable and battle-tested, I recommend serve and http-server.

Otherwise servitsy, sirv-cli or servor might work for you.

† Installed size is the uncompressed size of the package and its dependencies (as reported by du on macOS; exact size may depend on the OS and/or filesystem).

0.4.5

9 months ago

0.4.4

9 months ago

0.5.0

8 months ago

0.4.3

9 months ago

0.4.2

9 months ago

0.4.1

10 months ago

0.4.0

10 months ago

0.3.3

10 months ago

0.3.2

10 months ago

0.3.1

10 months ago

0.3.0

10 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago