blaze

Crates.ioblaze
lib.rsblaze
version0.1.6
sourcesrc
created_at2024-09-14 19:41:01.186733
updated_at2024-09-17 05:24:09.566089
descriptionblazing fast http framework
homepage
repository
max_upload_size
id1375007
size33,598
Mack (theMackabu)

documentation

README

Blaze

Blaze is a lightweight, asynchronous web framework for Rust, designed for simplicity and performance.

Features

  • Asynchronous request handling
  • Routing with support for path parameters
  • JSON serialization and deserialization
  • Easy-to-use macros for defining routes

Quick Start

  1. Add Blaze to your Cargo.toml

  2. Create a simple web server:

use blaze::{prelude::*, routes, Json};
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
struct Hello {
	 name: &'static str,
	 message: String,
}

#[blaze::route(get, "/hello/{name}")]
async fn hello(_req: Request, name: String) -> Json<Hello> {
	 Json(Hello {
		  name: "Blaze",
		  message: format!("Hello, {}!", name),
	 })
}

#[blaze::main]
fn main() {
	 let router = routes! {
		  hello,
	 };

	 Server::bind("127.0.0.1", 8080).serve(router)?
}
  1. Run your server and visit http://localhost:8080/hello/world in your browser.
Commit count: 0

cargo fmt