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.
- CLI
- HTTP/HTTPS
- WebSockets
- Static file hosting
- Live reload browser page
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 .
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.
That helped me build handcar
- WebSocket Protocol RFC
- How to implement a websocket server
- express
example/favicon.ico
from Handcar icons created by Freepik - Flaticon