actix_prerender/
lib.rs

1//! # Example
2//! ```no_run
3//! use actix_prerender::Prerender;
4//! use actix_web::{get, http, web, App, HttpRequest, HttpResponse, HttpServer};
5//!
6//! #[get("/index.html")]
7//! async fn index(req: HttpRequest) -> &'static str {
8//!     "<p>Hello World!</p>"
9//! }
10//!
11//! #[actix_web::main]
12//! async fn main() -> std::io::Result<()> {
13//!     HttpServer::new(|| {
14//!         let prerender = Prerender::build().use_prerender_io("service_token".to_string());
15//!
16//!         App::new()
17//!             .wrap(prerender)
18//!             .service(index)
19//!     })
20//!     .bind(("127.0.0.1", 8080))?
21//!     .run()
22//!     .await;
23//!
24//!     Ok(())
25//! }
26//! ```
27
28#![forbid(unsafe_code)]
29#![deny(nonstandard_style)]
30#![allow(clippy::must_use_candidate, clippy::missing_panics_doc, clippy::missing_errors_doc)]
31#![warn(future_incompatible)]
32#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
33#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
34
35use consts::{IGNORED_EXTENSIONS, USER_AGENTS};
36
37mod builder;
38mod consts;
39mod error;
40mod middleware;
41
42pub use builder::Prerender;
43pub use error::PrerenderError;
44pub use middleware::PrerenderMiddleware;