guest-server

Crates.ioguest-server
lib.rsguest-server
version0.1.4
sourcesrc
created_at2024-11-28 09:29:17.045918
updated_at2024-12-02 06:26:06.158636
descriptionA simple HTTP server implementation
homepagehttps://github.com/guestOfficer/guest
repositoryhttps://github.com/guestOfficer/guest
max_upload_size
id1464074
size10,147
guest (guestOfficer)

documentation

https://docs.rs/guest-server

README

Guest Server

A simple HTTP server implementation in Rust, designed for educational purposes or lightweight projects. This library provides a basic mechanism for handling HTTP GET requests and simulating a server response.

Features

  • Minimalistic design: Provides just enough functionality to serve HTTP GET requests.
  • Threaded handling: Each incoming request is handled in its own thread, making it easy to scale for multiple connections.
  • Easy to use: Simple API for registering GET routes and handling requests.

Example

Create a Server instance, register a GET route, and start the server:

use guest_server::Server;

let mut server = Server::new();
server.get("/", || "HTTP/1.1 200 OK\r\n\r\nHello, World!".to_string());
server.listener("127.0.0.1:8080");
Commit count: 6

cargo fmt