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

#628 in HTTP server

Download history 1075/week @ 2024-01-01 1138/week @ 2024-01-08 1509/week @ 2024-01-15 1376/week @ 2024-01-22 1924/week @ 2024-01-29 1582/week @ 2024-02-05 1284/week @ 2024-02-12 2333/week @ 2024-02-19 2427/week @ 2024-02-26 2070/week @ 2024-03-04 2198/week @ 2024-03-11 1728/week @ 2024-03-18 2021/week @ 2024-03-25 2441/week @ 2024-04-01 2348/week @ 2024-04-08 2345/week @ 2024-04-15

9,348 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
~707K SLoC