Inertia.rs
Inertia.js implementations for Rust. Currently supports Rocket.
Why Inertia?
From inertiajs.com
Inertia is a new approach to building classic server-driven web apps. We call it the modern monolith.
Inertia allows you to create fully client-side rendered, single-page apps, without much of the complexity that comes with modern SPAs. It does this by leveraging existing server-side frameworks.
Inertia has no client-side routing, nor does it require an API. Simply build controllers and page views like you've always done!
Inertia.rs brings a straightforward integration to Rust.
Installation
Add the following line to your Cargo.toml
= { = "0.2.0", = ["rocket"] }
Usage
inertia_rs
defines a succinct interface for creating Inertia.js apps in Rocket. It's comprised of two elements,
-
Inertia<T>
a Responder that's generic over
T
, the Inertia component's properties -
VersionFairing
Responsible for asset version checks. Constructed via
VersionFairing::new
, which is given the asset version and a closure responsible for generating the Inertia's HTML template.
Sample Rocket Server
extern crate rocket;
use ;
use Responder;
use Template;