# boltse
**A high-signal, lightweight HTTP static file server written in Rust.**
`boltse` is a minimal, zero-config utility designed for developers who need a reliable way to serve local directories over HTTP. It focuses on simplicity, fast startup, and a clean, directory-indexed web interface.
## 🚀 Quick Start
### Installation
Install directly via cargo:
```bash
cargo install boltse
```
### CLI Usage
Run the server in your current directory (defaults to `127.0.0.1:8080`):
```bash
boltse
```
Customise host, port, and path using flags:
```bash
boltse --host 0.0.0.0 --port 3000 --path ./public
```
## 📦 Use as a Library
`boltse` is structured as a library crate, allowing you to embed a file server directly into your own Rust applications.
### Implementation Example
Add `boltse` to your `Cargo.toml` and call the public `serve` function:
```rust
use boltse;
fn main() {
// Parameters: host, port, and root directory
boltse::serve("127.0.0.1", "8080", ".");
}
```
### API Reference
*
**`serve(host: &str, port: &str, root_dir: &str)`**: The primary entry point that binds the TCP listener and begins handling incoming requests.
## ✨ Features
* **Zero Configuration:** Smart defaults for local development.
* **Automatic Indexing:** Generates a clean, navigable HTML index for directories without an `index.html`.
* **Path Decoding:** Full support for URL-encoded characters in filenames.
* **Informative Logging:** Real-time feedback on requests and server status.
* **Type Inference:** Automatically maps common file extensions to correct MIME types (HTML, CSS, JS, WebP, WASM, and more).
## 🛠 Configuration Options
| `--host` | IP address or domain to bind to | `127.0.0.1` |
| `--port` | Port number to listen on | `8080` |
| `--path` | The root directory to serve | `.` |
## ⚖️ License
This project is licensed under the **MIT License**. See the [LICENSE](https://www.google.com/search?q=LICENSE) file for details.
---
*Built with simplicity in mind by [Jonas](https://codeberg.org/jornis/boltse).*