Crates.io | operator |
lib.rs | operator |
version | 0.6.3 |
source | src |
created_at | 2020-09-02 03:25:04.778475 |
updated_at | 2024-07-13 13:43:59.199308 |
description | A web server for static and dynamic content |
homepage | https://operator.mattkantor.com |
repository | https://github.com/mkantor/operator |
max_upload_size | |
id | 283727 |
size | 290,816 |
Operator is a web server. You provide a directory and Operator serves it over HTTP.
It serves static files the way you'd expect, but it can also serve dynamic content that is generated at request time by handlebars templates or executables.
More information is available on the Operator website.
Operator is a single self-contained binary. You can download a build from the releases list, unzip it, and run it from any working directory.
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 the folder
where your website lives. There are a bunch of sample content directories in
samples/
.
To learn more, run operator --help
or operator <SUBCOMMAND> --help
.
Let's run a server for one of the samples:
git clone git@github.com:mkantor/operator.git
cd operator
cargo run -- -vv serve \
--content-directory=samples/realistic-advanced \
--index-route=/home \
--error-handler-route=/error-handler \
--bind-to=127.0.0.1:8080
Then open http://localhost:8080 in your browser of choice.
Operator is very young and has not been battle-hardened. There are known flaws and obvious missing features that need to be addressed. The major ones are filed as issues. All feedback is greatly appreciated.
This is my first nontrivial Rust project and I'm sure there are places where things could be improved. One of the reasons I created Operator was to get more experience with the language, so if you notice anything iffy (no matter how small), please open an issue to help me out! ❤️