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.
```rust
use actixprerender::Prerender; use actixweb::http::header;
let token = "prerender service token".tostring(); let prerender = Prerender::build().useprerender_io(token);
// prerender
can now be used in App::wrap
.
```
```rust use actixprerender::Prerender; use actixweb::http::header;
let token = "prerender service token".tostring(); let prerender = Prerender::build().usecustomprerenderurl("https://localhost:5001");
// prerender
can now be used in App::wrap
.
```
Add this into your Cargo.toml
toml
actix-prerender = "0.2"