Crates.io | actix-prerender |
lib.rs | actix-prerender |
version | 0.2.4 |
source | src |
created_at | 2022-03-02 19:21:57.924435 |
updated_at | 2022-04-25 22:43:58.53358 |
description | Actix middleware that sends requests to Prerender.io or a custom Prerender service URL. |
homepage | |
repository | https://github.com/saskenuba/actix-prerender |
max_upload_size | |
id | 542494 |
size | 30,967 |
A simple middleware that sends HTTP requests from known crawlers user-agents to render as HTML by an external prerender service URL such as tvanro/prerender-alpine, or from the service from the creators prerender.io.
Useful to websites with tons of javascript, such as SPAs like Vue.js or React among others.
use actix_prerender::Prerender;
use actix_web::http::header;
let token = "prerender service token".to_string();
let prerender = Prerender::build().use_prerender_io(token);
// `prerender` can now be used in `App::wrap`.
use actix_prerender::Prerender;
use actix_web::http::header;
let token = "prerender service token".to_string();
let prerender = Prerender::build().use_custom_prerender_url("https://localhost:5001");
// `prerender` can now be used in `App::wrap`.
Add this into your Cargo.toml
actix-prerender = "0.2"