| Crates.io | crab-http |
| lib.rs | crab-http |
| version | 0.2.1 |
| created_at | 2025-05-22 10:54:36.179029+00 |
| updated_at | 2025-07-21 15:36:05.987357+00 |
| description | A lightweight HTTP server for serving static files |
| homepage | https://github.com/arjav0703/http-server |
| repository | https://github.com/arjav0703/http-server |
| max_upload_size | |
| id | 1685019 |
| size | 34,723 |
This is a fast and lightweight (less than 2 MB) HTTP server written in Rust 🦀
cargo install crab-httpcrab-http
Note: Make sure that port 8080 is not in use. You can change the port by using the --port flag.
3. Make your first request:
curl http://localhost:8080/echo/hello-world
crab-http --help
for more options.
git clone https://github.com/arjav0703/http-server.git
cd http-server
cargo build --release
./target/release/crab-http
Port, directory, and write access configuration through command line arguments.
File serving:
You can access any file in the specified directory using the URL http://localhost:8080/files/<filename>.
File Creation:
You can create a file by sending a POST request with the file content to the URL http://localhost:8080/files/<filename>. The server will create a file with the specified name in the specified directory.
File Updation:
You can update a file by sending a POST request with the new content to the URL http://localhost:8080/files/<filename>. The server will update the file with the specified name in the specified directory.
Route echo:
You can echo any string using the URL http://localhost:8080/echo/<string>. The server will respond with the same string.
User agent:
The server will respond with the user agent string on sending a request to http://localhost:8080/user-agent.
File Protection: The server will not allow access to files beginning with a '.' or a '_'