Convert scala objects to HTML.
100K+
A simple, light-weight server that transpiles Scala code to HTML.
This project arose from the need to build React components using Scala. Under the hood, html-scala uses scalatags. Look at scalatags to see what Scala code you can write and how it is transformed to HTML.
Scala code:
new ReactComponent {
def messageOfTheDay() = "Hello World!"
override def render(): Text.TypedTag[String] = {
div(
h1("Amazing Title"),
div(
p("Message of the day: " + messageOfTheDay()),
p("This is the first paragraph."),
p("This is the second paragraph.")
)
)
}
}
Resulting HTML:
<div>
<h1>Amazing Title</h1>
<div>
<p>Message of the day: Hello World!</p>
<p>This is the first paragraph.</p>
<p>This is the second paragraph.</p>
</div>
</div>
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, using ReactComponent.
You can check the status of the service with a simple GET request to /status. If everything is okay, 200 should be returned.
You can find this server as a docker image under julianbrendl/html-scala.
Content type
Image
Digest
Size
765.4 MB
Last updated
over 7 years ago
docker pull julianbrendl/html-scala