Operator is an experimental web server for static and dynamic content. You give it a directory and it makes a website.
Operator serves static files the way you'd expect, but it can also serve dynamic content generated by handlebars templates and executables.
Operator is a single self-contained binary. At the moment, the best way to get a binary for your platform is to build one yourself. First install Rust, then:
sh
git clone https://github.com/mkantor/operator.git
cd operator
cargo build --release # This will take a while.
echo '{{#if true}}Hello, operator!{{/if}}' \
| ./target/release/operator eval --content-directory=/dev/null
The CLI has three subcommands:
eval
evaluates a handlebars template from STDIN.get
renders content from a content directory.serve
starts an HTTP server.serve
is where the real action is, but the other two come in handy at times.
These commands all require a "content directory", which is just a folder where
your website content lives. There are a bunch of example content directories in
samples/
.
To learn more, run operator --help
or operator <SUBCOMMAND> --help
.
Let's start a server for one of the samples:
sh
operator -vv serve \
--content-directory=samples/realistic-advanced \
--index-route=home \
--error-handler-route=error-handler \
--bind-to=127.0.0.1:8080
Open http://localhost:8080 in your browser of choice to see the website!