Crates.io | serwus |
lib.rs | serwus |
version | 0.2.0 |
source | src |
created_at | 2023-09-26 06:54:51.292765 |
updated_at | 2024-04-22 11:56:26.612193 |
description | Helpers for building actix-web/diesel based services |
homepage | https://github.com/sfisol/serwus |
repository | https://github.com/sfisol/serwus |
max_upload_size | |
id | 983352 |
size | 104,782 |
Helpers for building actix-web/diesel based services.
r2d2
use actix_web::web;
use serwus::{
server::{Serwus, default_cors},
EmptyStats
};
#[derive(Clone, EmptyStats)]
pub struct AppData;
async fn hello() -> &'static str {
"Hello world\n"
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let prepare_app_data = || AppData;
Serwus::default()
.start(
prepare_app_data,
|app| {
app.route("/", web::get().to(hello));
},
default_cors,
)
.await
}