Skip to content
/ handcar Public

Minimal webserver. Live reload, WebSockets, File Server, Express compliant(ish)

Notifications You must be signed in to change notification settings

mablay/handcar

Repository files navigation

Handcar

Lightweight development web server inspired by express and connect.

As the name suggests it's heavily inferior to express. It focusses only on the most useful features and provides them with a minimum of dependencies:

  • ws the goto NodeJS WebSocket implementation (zero sub dependencies)
  • commander excellent CLI agrument parser (zero sub dependencies)

STATUS: Working, but in development.

Features

  • CLI
  • HTTP/HTTPS
  • WebSockets
  • Static file hosting
  • Live reload browser page

CLI

Usage: handcar [options] <webroot>

development webserver

Arguments:
  webroot            path to webroot

Options:
  -V, --version      output the version number
  -s, --https        Use HTTPS
  -H, --host <host>  Use '0.0.0.0' to expose the server (default: "localhost")
  -p, --port <port>  The port the webserver will use (default: 8080)
  -w, --no-watch     Prevent watching the webroot for changes
  -o, --open         Open browser
  -h, --help         display help for command

Example:

# start webserver in local directory using HTTPS and live reload.
handcar -s .

Usage

import { createServer } from 'handcar'

const app = createServer({
  host: '0.0.0.0',
  port: 8080,
  https: false,
  webroot: '.',
  watch: true,
  open: false
})

Setting https to true, will generate localhost-cert.pem and localhost-key.pem files in your CWD if they don't allready exist.

Sources

That helped me build handcar

About

Minimal webserver. Live reload, WebSockets, File Server, Express compliant(ish)

Resources

Stars

Watchers

Forks

Packages