https://github.com/tejmagar/rusty-web
The light web framework for Rust.
https://github.com/tejmagar/rusty-web
framework rust web
Last synced: 8 months ago
JSON representation
The light web framework for Rust.
- Host: GitHub
- URL: https://github.com/tejmagar/rusty-web
- Owner: tejmagar
- Created: 2024-02-07T09:40:38.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-08T05:39:28.000Z (almost 2 years ago)
- Last Synced: 2024-11-07T03:49:39.015Z (over 1 year ago)
- Topics: framework, rust, web
- Language: Rust
- Homepage: https://tejmagar.github.io/rusty-web/
- Size: 608 KB
- Stars: 17
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rusty Web

Rusty web is a simple to use, fully customizable lightweight web framework for rust developers.
[Learn rusty web](https://tejmagar.github.io/rusty-web/)
Consider using [Racoon](https://github.com/tejmagar/racoon/) if you need asynchronous code.
## Installation
```
[dependencies]
rusty-web = "0.0.2"
```
## Sample
```rust
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);
}
```
## Conclusion
This framework don't force you to follow particular format. You can stream response however you like.