# Operator
Operator is an experimental web server for static and dynamic content. You give
it [a directory](samples/realistic-basic) and it makes a website.
Operator serves static files the way you'd expect, but it can also serve
[dynamic content](samples/realistic-advanced) generated by handlebars templates
and executables.
## Installation
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](https://doc.rust-lang.org/book/ch01-01-installation.html), 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
```
## Usage
The CLI has three subcommands:
1. `eval` evaluates a handlebars template from STDIN.
1. `get` renders content from a content directory.
1. `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/`](samples).
To learn more, run `operator --help` or `operator <SUBCOMMAND> --help`.
### Example
Let's start a server for [one of the samples](samples/realistic-advanced):
```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](http://localhost:8080) in your browser of choice
to see the website!
---
<p align="center"><img src="operator.jpg" /></p>