vujio

Crates.iovujio
lib.rsvujio
version0.1.3
sourcesrc
created_at2021-01-01 17:16:35.753
updated_at2021-01-03 22:22:52.061488
descriptionAn _experimental_ fast and pertinent web platform for modern devices.
homepage
repositoryhttps://github.com/vujio/vujio
max_upload_size
id330141
size10,682
Shawn K (skhameneh)

documentation

README

vuj.io

github.com vujio crates.io vujio

/vu-hē-oʊ/

Description

An experimental fast and pertinent web platform for modern devices.
Rust backend and TypeScript frontend.

See https://github.com/vujio/vujio

Example:

use vujio::*;

#[server("127.0.0.1:8080")]
async fn main() {
    #[get_html("/")]
    async fn main(_req: Request<AppState>) -> String {
        let directory_links = ["test_path"].map(|v| format!("<a href=\"{}\">{}</a>", v, v));
        let directory_list = format!("<p>Directory:<ul>{}</ul></p>", directory_links.join(""));

        format!(
            "Pages:<br>{}", directory_list
        )
    }

    #[get_html]
    async fn test_path(_req: Request<AppState>) -> String {
        "Page: /test_path".into()
    }

    #[message("/websocket")]
    async fn message(stream: &WebSocketConnection, input: String) {
        println!("Client says: {:?}", input);
        stream.send_string("server response".into()).await;
    }

    #[binary_stream("/ws")]
    async fn my_stream(stream: &WebSocketConnection, input: Vec<u8>) {
        stream.send_bytes(input).await;
    }
}
Commit count: 11

cargo fmt