You can use the HTTP Val to return HTML pages. You can copy the URL by using the menu and selecting Endpoints > Copy web endpoint.
https://www.val.town/embed/neverstew.webHTMLExample
Click on this URL to view the above Val: https://neverstew-webHTMLExample.web.val.run?name=Steve.
By importing a markdown library like Marked, you can render markdown to HTML.
https://www.val.town/embed/neverstew.markdownExample
View the result by clicking on this URL: https://neverstew-handleDiscordNewUser.web.val.run
You can import ReactDOMServer
from the react-dom/server
module to perform server-side rendering with React.
Note: JSX is not supported yet.
https://www.val.town/embed/neverstew.reactSSRExample
ReactDOMServer.renderToString
converts the TodoList
component into HTML which is sent to the client as the initial server response, which you can view here: https://neverstew-reactSSRExample.web.val.run