Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/burdockcascade/teapot
A simple and modern web framework for rust
https://github.com/burdockcascade/teapot
http hyper rest-api rust web-framework
Last synced: 2 months ago
JSON representation
A simple and modern web framework for rust
- Host: GitHub
- URL: https://github.com/burdockcascade/teapot
- Owner: burdockcascade
- License: mit
- Created: 2024-04-17T21:29:00.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-04-18T00:03:10.000Z (9 months ago)
- Last Synced: 2024-04-18T22:37:26.164Z (9 months ago)
- Topics: http, hyper, rest-api, rust, web-framework
- Language: Rust
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# TEAPOT
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE-MIT)
[![GHA Build Status](https://github.com/burdockcascade/teapot/workflows/CI/badge.svg)](https://github.com/burdockcascade/teapot/actions?query=workflow%3ACI)## Status
This project is in early development and is not yet ready for production use.## Example
```rust
fn main() {
info!("Starting teapot server example...");
let my_teapot = Arc::new(Mutex::new(MyHandler { counter: 0 }));
HttpServer::builder()
.address("127.0.0.1")
.port(80)
.route(RouteBuilder::http()
.get("/teapot")
.handler(my_teapot.clone())
.build()
.expect("valid route"))
.start();}
struct MyHandler {
counter: u16
}impl RouteHandler for MyHandler {
fn on_request(&mut self, _request: &HttpServerRequest) -> HttpServerResponse {
self.counter += 1;
let message = format!("Serving cup number {}", self.counter);
HttpServerResponse::builder()
.status(StatusCode::OK)
.header("Content-Type", "text/plain")
.body(Body::text(message))
.build()
}
}
```## License
Licensed under the MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)