diff --git a/readme.md b/readme.md index d89b5db..614892e 100644 --- a/readme.md +++ b/readme.md @@ -1,107 +1,135 @@ -# π΅ HteaPot HTTP Server +
A blazing-fast, minimalist HTTP server library built with Rust
-[Spanish](docs/i8n/readme-es.md) | 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. + -# Features -### 1. **Threaded Architecture** - Custom thread-based system, capable of handling around **70,000 requests per second**. +A high-performance, lightweight HTTP server and library built in Rust. HTeaPot is designed to deliver exceptional performance for modern web applications while maintaining a simple and intuitive API. +## Features -### 2. **Performance Under Load** - Steady performance under high concurrency +### Exceptional Performance +- **Threaded Architecture**: Powered by a custom-designed thread system that handles **70,000+ requests per second** +- **Consistent Under Load**: Maintains steady performance even under high concurrency scenarios +- **Resilient**: Achieves **near-perfect 100% success rate** for 200 OK responses during stress tests +### Versatile Functionality +- **Static File Serving**: Efficiently serve static assets with minimal configuration +- **Streaming Support**: Leverages chunked transfer encoding for large files and long-lived connections +- **Flexible API**: Use HTeaPot as a standalone server or as a library in your Rust applications -### 3. **Low Error Rate** - - 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. +### Developer-Friendly +- **Simple Configuration**: Get started quickly with intuitive TOML configuration +- **Extensible Design**: Easily customize behavior for specific use cases +- **Lightweight Footprint**: Zero dependencies and efficient resource usage -### 4. **Streaming Support** - Supports response streaming via chunked transfer encoding, useful for large files or long-lived connections. -### 5. **Library** - Hteapot can be used as create library , allowing to extend or adapt it to your custom use. +## π Getting Started +### Installation -# Use +```bash +# Install from crates.io +cargo install hteapot + +# Or build from source +git clone https://github.com/yourusername/hteapot.git +cd hteapot +cargo build --release +``` + +### Standalone Server -## standalone http server +#### Using a configuration file: -You can configure the server using a TOML file. Here's an example configuration: +Create a `config.toml` file: ```toml [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. +port = 8081 # The port to listen on +host = "localhost" # The host address to bind to +root = "public" # The root directory to serve files from ``` -Then running with +Run the server: + ```bash -$ hteapot ./config-file.toml +hteapot ./config.toml ``` -or serving a file or folder directly +#### Quick serve a directory: + ```bash -$ hteapot -s ./public/ +hteapot -s ./public/ ``` -## Library +### As a Library + +1. Add HTeaPot to your project: -For use hteapot as a library in rust - 1. Install the library - ```bash - $ cargo add hteapot - ``` +```bash +cargo add hteapot +``` + +2. Implement in your code: - 2. Then you can use it in your project ```rust use hteapot::{HttpStatus, HttpResponse, Hteapot, HttpRequest}; fn main() { + // Create a new server instance let server = Hteapot::new("localhost", 8081); + + // Define your request handler server.listen(move |req: HttpRequest| { HttpResponse::new(HttpStatus::IAmATeapot, "Hello, I am HTeaPot", None) }); } ``` -# Build +## Performance -1. Clone the repository: -```bash -git clone