Model-View-Controller
Corvis has no template engine integration: there is no decorator to render a view (@Render), and no configuration for a views folder or engine (Handlebars, Pug, etc.).
What does exist:
Returning HTML. A handler can return
Html(...)orResponse::html(...), which respond withContent-Type: text/html; charset=utf-8. You can generate that HTML with any template crate from the Rust ecosystem (for exampleaskama,minijinjaortera) and wrap the result:rustuse corvis::Html; // not in the prelude #[get] fn index(&self) -> Html<String> { let name = "Corvis"; Html(format!("<h1>Hello, {name}</h1>")) }If you interpolate user data, escape it:
format!does not do it. Template engines usually escape by default.Serving static files.
corvis::serve_static(folder)orServeStaticModuleserve HTML, CSS, JavaScript and images, for example for an SPA.examples/tertuliaserves its web client this way frompublic/. See Static files.Redirects.
Redirect::to("/login"),Redirect::permanent(..)or#[redirect("url", 301)].