Crates.io | axum-wasm-macros |
lib.rs | axum-wasm-macros |
version | 0.1.2 |
source | src |
created_at | 2023-07-19 02:13:23.668446 |
updated_at | 2023-09-09 01:42:36.425596 |
description | A macro to enable compabatility between Axum and and WASM |
homepage | |
repository | https://github.com/logankeenan/axum-wasm-macros |
max_upload_size | |
id | 919970 |
size | 9,675 |
A macro to ensure async axum routes can compile to WASM
Axum handlers return a Send
future. However, JS types do not return a Send
future. wasm_compat
will provide compatability between the return types.
use axum_wasm_macros::wasm_compat;
use axum::Router;
use axum::routing::get;
#[wasm_compat]
pub async fn index() -> &'static str {
"Hello World"
}
pub fn main() {
let router: Router = Router::new().route("/", get(index));
// rest of the app code goes here.
}