Crates.io | webby |
lib.rs | webby |
version | 0.0.6 |
source | src |
created_at | 2021-05-02 20:57:41.361549 |
updated_at | 2021-05-02 20:57:41.361549 |
description | A very simple HTTP 1.1 web server |
homepage | |
repository | https://github.com/tntmeijs/webby |
max_upload_size | |
id | 392318 |
size | 29,026 |
Webby is a simple Rust web server that supports HTTP 1.1.
The Rust ecosystem comes with a lot of third-party web server crates. A lot of crates are absolutely brilliant, but none of them really teach you how a web server works. This crate allows me to discover how HTTP 1.1 works, how to handle requests, asynchronous programming, and much, much more!
Right now, I wouldn't recommend using this crate in any serious projects. It's simply too slow and unreliable.
// Run a server on localhost:8080
fn main() {
webby::create("127.0.0.1", 8080)
.start_listening();
}
No web server would be complete without any sort of routing, which is why Webby supports routing too.
You can either use functions, or lambda functions. As long as you match the expected function signature, it'll work!
fn index() -> HttpResponse {
println!("This is an index route, it only ever returns HTTP 204.");
HttpResponse::new().no_content()
}
fn main() {
webby::create("127.0.0.1", 8080)
.add_route(HttpMethod::GET, "/", index)
.start_listening();
}
master
using the following format: feature/<your-feature-name-here>
.master
.README.md
.I've tried to keep Webby as simple as possible. However, some tasks are just out of scope for this project.
.env
file