Crates.io | hteapot |
lib.rs | hteapot |
version | 0.3.1 |
source | src |
created_at | 2024-06-06 18:23:58.669951 |
updated_at | 2024-11-07 09:09:42.299097 |
description | HTeaPot is a lightweight HTTP server library designed to be easy to use and extend. |
homepage | https://github.com/az107/HTeaPot |
repository | https://github.com/az107/HTeaPot |
max_upload_size | |
id | 1263964 |
size | 46,572 |
Spanish | English
Hteapot is a powerful, Rust-based HTTP server and library designed for high-performance web applications. Effortlessly serve static files and handle HTTP requests with resilience and speed.
Achieves a near 100% success rate for 200 OK responses during stress tests, demonstrating strong resilience.
Outperforms others at similar loads, with minimal error rates under extreme concurrency.
You can configure the server using a TOML file. Here's an example configuration:
[HTEAPOT]
port = 8081 # The port on which the server will listen for incoming connections.
host = "localhost" # The host address to bind the server to.
root = "public" # The root directory from which to serve files.
Then running with
$ hteapot ./config-file.toml
or serving a file or folder directly
$ hteapot -s ./public/
For use hteapot as a library in rust
$ cargo add hteapot
use hteapot::{HttpStatus, Hteapot, HttpRequest};
fn main() {
let server = Hteapot::new("localhost", 8081);
teapot.listen(move|req| {
HttpResponse::new(HttpStatus::IAmATeapot, "Hello i am HTeaPot", None);
}
}
git clone <repository_url>
cargo build --release
Run the server with a configuration file:
Copy code
./target/release/hteapot <config_file_path>
Contributions are welcome! Feel free to open issues or submit pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.