playground-rs/README.md
2025-06-11 12:18:26 -04:00

57 lines
1.3 KiB
Markdown

# Playground RS
A simple multi-threaded web server implementation in Rust. This project demonstrates the implementation of a basic HTTP server with a thread pool for handling concurrent connections.
## Features
- Multi-threaded web server implementation
- Custom thread pool for handling concurrent connections
- Basic HTTP response handling
- Graceful shutdown mechanism
## Project Structure
- `src/main.rs` - Entry point of the application
- `src/server.rs` - Web server implementation
- `src/thread_pool.rs` - Custom thread pool implementation
## Requirements
- Rust 2024 edition
- Cargo (Rust's package manager)
## Running the Project
1. Clone the repository:
```bash
git clone <repository-url>
cd playground-rs
```
2. Build and run the project:
```bash
cargo run
```
The server will start on `127.0.0.1:7878`. You can test it by opening a web browser and navigating to `http://127.0.0.1:7878` or using curl:
```bash
curl http://127.0.0.1:7878
```
## Implementation Details
### Thread Pool
The project implements a custom thread pool that:
- Creates a fixed number of worker threads
- Uses message passing for job distribution
- Handles graceful shutdown
- Manages thread lifecycle
### Web Server
The web server:
- Listens on localhost port 7878
- Uses the thread pool to handle incoming connections
- Responds with a simple "Hello, world!" message