bestia.dev This is a copy of the Codeberg readme, only because of SEO. Find the original on https://codeberg.org/bestia-dev-work-in-progress/basic-http-server

A simple static HTTP file server, for learning and local development
version: 2026.717.1111 date: 2026-07-17 author: bestia.dev repository: codeberg.org

http server static file-server

Lines in Rust code Lines in Doc comments Lines in Comments Lines in examples Lines in tests

basic-http-server

A simple static HTTP server, for learning and local development.

Forked

This is a fork of the repository https://github.com/brson/basic-http-server.
I will use it for learning purposes.
I will build a release for linux, so I can download the binary.

Basics

basic-http-server is designed for two purposes:

The core server setup is contained in main.rs. Error types and HTML rendering are in server.rs. The developer extensions are in ext/, with each extension implemented as tower middleware.

Developer extensions

When passed the -x flag, basic-http-server enables additional conveniences useful for developing documentation locally. Those extensions are:

All rendered pages support dark and light mode, following the system preference.

This makes basic-http-server useful for the following scenarios:

Installation and Use

Note that basic-http-server is not production-ready and should not be exposed to the internet. It is a learning and development tool.

Install with cargo install:

cargo install basic-http-server
basic-http-server

To turn on the developer extensions, pass -x:

basic-http-server -x

Set a custom port with -p:

basic-http-server -x -p8080

Listen on all interfaces with --public:

basic-http-server -x -p8080 --public

To increase logging verbosity use RUST_LOG:

RUST_LOG=basic_http_server=trace basic-http-server -x

Command line arguments:

Usage: basic-http-server [OPTIONS] [ROOT_DIR]

Arguments:
  [ROOT_DIR]  The root directory for serving files [default: .]

Options:
  -a, --addr <ADDR>  The IP:PORT combination
  -p, --port <PORT>  Port number [default: 4000]
      --public       Listen on all interfaces (0.0.0.0) instead of localhost
  -x                 Enable developer extensions
  -h, --help         Print help
  -V, --version      Print version

License

MIT

TODO

Nothing for now.

Open-source and free as a beer

My open-source projects are free as a beer (MIT license).
I just love programming.
But I also need to drink. If you find my projects and tutorials helpful, please buy me a beer by donating to my PayPal.
You know the price of a beer in your local bar ;-)
So I can drink a free beer for your health :-)
Na zdravje! Alla salute! Prost! Nazdravlje! 🍻

//bestia.dev
//codeberg.org/bestia-dev
//github.com/bestia-dev
//bestiadev.substack.com
//youtube.com/@bestia-dev-tutorials