Crates.io | web-base |
lib.rs | web-base |
version | 0.2.2 |
source | src |
created_at | 2023-09-16 15:34:47.981287 |
updated_at | 2023-09-30 13:02:37.490354 |
description | collection of utilities and configurations for building web applications |
homepage | https://git.hydrar.de/jmarya/web-base |
repository | https://git.hydrar.de/jmarya/web-base |
max_upload_size | |
id | 974407 |
size | 91,420 |
web_base is an open-source Rust crate designed to simplify web application development by providing a collection of utilities and configurations for building web applications.
web_base provides several examples and use cases for its features. Check the documentation and code examples to see how to leverage this library for your web application needs.
To use this crate in your project, you have to add tokio
and actix-web
to your Cargo.toml
.
Run some examples from examples
directory or use this as a base:
use actix_web::{get, HttpRequest, Responder};
use maud::html;
#[get("/")]
pub(crate) async fn index(r: HttpRequest) -> impl Responder {
let content = html!(
p { "Hello World" };
)
.into_string();
web_base::func::build_site(&r, "Index", &content)
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
web_base::map!(
web_base::Site::new()
.enable_bootstrap(false)
.enable_picocss(false),
|app: actix_web::App<_>| { app.service(index) }
)
.bind(("0.0.0.0".to_string(), 8080))?
.run()
.await
}