Sauron is a versatile web framework and library for building client-side and/or server-side web applications with strong focus on simplicity. It is suited for developing web application which uses progressive rendering.
In your src/lib.rs
```rust
use sauron::html::text;
use sauron::prelude::*;
use sauron::{node, Cmd, Application, Node, Program};
pub enum Msg { Increment, Decrement, }
pub struct App { count: i32, }
impl App { pub fn new() -> Self { App { count: 0 } } }
impl Application
fn update(&mut self, msg: Msg) -> Cmd<Self, Msg> {
match msg {
Msg::Increment => self.count += 1,
Msg::Decrement => self.count -= 1,
}
Cmd::none()
}
}
pub fn main() {
Program::mounttobody(App::new());
}
`index.html`
html
In
Cargo.toml, specify the crate-type to be
cdylib`
```toml [package] name = "counter" version = "0.1.0" edition = "2018"
[lib] crate-type = ["cdylib"]
[dependencies] sauron = "0.41" ```
Build using
sh
$> wasm-pack build --target web --release
Explore some other examples
on this repo.
sh
cargo install wasm-pack
cargo install basic-http-server
License: MIT