A simple, light-weight server that transpiles Haskell code to HTML.
This project arose from the need to build React components using Haskell. Under the hood, html-haskell uses type-of-html. Look at type-of-html to see what Haskell code you can write and how it is transformed to HTML.
Haskell code:
render = div_ $ colorPp "red" (genString "Hello")
colorPp color content = p_A (A.style_ $ "color: " ++ color) content
genString :: String -> String
genString str = str ++ " " ++ str ++ "!"Resulting HTML:
<div>
<p style="color: red">Hello Hello!</p>
</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, providing the render function that returns a Haskell-HTML.
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-haskell.