A minimal, customisable and multithreaded web server written in Rust.
- Simple API for starting and managing the server
- Easily extensible for custom logic and routing
- Multithreaded for handling multiple requests concurrently
Clone the repository and build with Cargo:
git clone https://github.com/believemanasseh/rusticore.git
cd rusticore
cargo build --releaseThe compiled binary will be in target/release/rusticore.
Add to your Cargo.toml:
[dependencies]
rusticore = "0.1.0"Then run:
cargo build --releaseAfter building, run the server:
./target/release/rusticoreImport and use in your Rust project:
use rusticore::Server;
use rusticore::Route;
use http::StatusCode;
#[tokio::main]
async fn main() {
let mut server = Server::new("localhost", 9000, false, None);
let route = Route::new(
"GET",
"/hello",
Arc::new(|req, res| Box::pin(async move {
res.text("Hello, world!", StatusCode::OK).await;
}))
);
server.add_route(route).await;
server.start().await.unwrap();
}To run tests, use:
# Unit tests
cargo test --lib
# Integration tests
cargo test --test test_*This project is licensed under the MIT License - see the LICENSE file for details.