Skip to content

jundl77/html-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

html-rust

A simple, light-weight server that transpiles Rust code to HTML.

This project arose from the need to build React components using Rust. Under the hood, html-rust uses typed-html. Look at typed-html to see what Rust code you can write and how it is transformed to HTML.

Example:

Rust code:

fn render() -> DOMTree<String> {
    let code = "HELLO WORLD!";

    return html!(
        <div>{ text!(code) }</div>
    );
}

Resulting HTML:

<div>HELLO WORLD!</div>

API

/transpile

Make a POST request to /transpile with the following payload as JSON:

{
  code: "code to transpile"
}

Important: The code has to be formatted as shown in the example above, providing fn render() -> DOMTree<String> .

/status

You can check the status of the service with a simple GET request to /status. If everything is okay, 200 should be returned.

Docker

You can find this server as a docker image under julianbrendl/html-rust.

About

A REST API to convert rust code to HTML.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published