Crates.io | rusty-web |
lib.rs | rusty-web |
version | 0.0.2 |
source | src |
created_at | 2024-02-20 13:18:34.00195 |
updated_at | 2024-03-20 03:27:01.608083 |
description | Rusty Web is a lightweight web framework for rust developers. |
homepage | |
repository | https://github.com/tejmagar/rusty-web/ |
max_upload_size | |
id | 1146388 |
size | 130,829 |
Rusty web is a simple to use, fully customizable lightweight web framework for rust developers. Learn rusty web
[dependencies]
rusty-web = "0.0.1"
use rusty_web::paths::{Path, Paths};
use rusty_web::request::Request;
use rusty_web::response::Response;
use rusty_web::server::run_server;
use rusty_web::status::Status;
fn home(request: Request, mut response: Response) {
response.html(Status::Ok, "Home Page".to_string()).send();
}
fn about(request: Request, mut response: Response) {
response.html(Status::Ok, "About Us".to_string()).send();
}
fn main() {
let paths: Paths = vec![
Path::new("/", home),
Path::new("/about/", about),
];
run_server("0.0.0.0:8080", paths);
}
This framework don't force you to follow particular format. You can stream response however you like.