61 releases

0.6.11 Apr 10, 2024
0.6.9 Mar 4, 2024
0.6.0-alpha Dec 21, 2023
0.5.4 Nov 28, 2023
0.0.2 Nov 28, 2022

#483 in HTTP server

Download history 909/week @ 2023-12-23 1060/week @ 2023-12-30 1219/week @ 2024-01-06 1432/week @ 2024-01-13 1382/week @ 2024-01-20 1815/week @ 2024-01-27 1555/week @ 2024-02-03 1350/week @ 2024-02-10 2208/week @ 2024-02-17 2365/week @ 2024-02-24 2010/week @ 2024-03-02 2370/week @ 2024-03-09 1742/week @ 2024-03-16 2044/week @ 2024-03-23 2236/week @ 2024-03-30 2027/week @ 2024-04-06

8,327 downloads per month
Used in 9 crates (8 directly)

MIT license

595KB
11K SLoC

Provides functions to easily integrate Leptos with Axum.

JS Fetch Integration

The leptos_axum integration supports running in JavaScript-hosted WebAssembly runtimes, e.g., running inside Deno, Cloudflare Workers, or other JS environments. To run in this environment, you need to disable the default feature set and enable the wasm feature on leptos_axum in your Cargo.toml.

leptos_axum = { version = "0.6.0", default-features = false, features = ["wasm"] }

Features

  • default: supports running in a typical native Tokio/Axum environment
  • wasm: with default-features = false, supports running in a JS Fetch-based environment
  • nonce: activates Leptos features that automatically provide a CSP Nonce via context
  • experimental-islands: activates Leptos islands mode

Important Note

Prior to 0.5, using default-features = false on leptos_axum simply did nothing. Now, it actively disables features necessary to support the normal native/Tokio runtime environment we create. This can generate errors like the following, which don’t point to an obvious culprit: spawn_localcalled from outside of atask::LocalSet If you are not using the wasm feature, do not set default-features = false on this package.

More information

For more details on how to use the integrations, see the examples directory in the Leptos repository.

Dependencies

~28–41MB
~708K SLoC