actix_web_lab/web.rs
1//! Experimental services.
2//!
3//! Analogous to the `web` module in Actix Web.
4
5#[cfg(feature = "spa")]
6pub use crate::spa::Spa;
7
8/// Constructs a new Single-page Application (SPA) builder.
9///
10/// See [`Spa`] docs for more details.
11///
12/// # Examples
13/// ```
14/// # use actix_web::App;
15/// # use actix_web_lab::web::spa;
16/// let app = App::new()
17/// // ...api routes...
18/// .service(
19/// spa()
20/// .index_file("./examples/assets/spa.html")
21/// .static_resources_mount("/static")
22/// .static_resources_location("./examples/assets")
23/// .finish(),
24/// );
25/// ```
26#[cfg(feature = "spa")]
27pub fn spa() -> Spa {
28 Spa::default()
29}