You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 18, 2021. It is now read-only.
With IBM discontinuing its involvement in server-side Swift, we are choosing to deprecate support for this library. It will remain in an archived state as an example of how to integrate with swift-html.
Kitura plugin for type-safe, transformable HTML views using swift-html.
Motivation
The most popular choice for rendering HTML in a Kitura web app is to use the Stencil templating language, but it exposes your application to runtime errors and invalid HTML. Our plugin prevents these runtime issues at compile-time by embedding HTML directly into Swift’s powerful type system. It uses the swift-html DSL for constructing HTML documents using plain Swift data structures.
Usage
To use the plugin all you have to do is return a Node value from your router callback:
import HtmlKituraSupport
import Kitura
letrouter=Router()
router.get("/"){ request, response, next in
response.send(Node.h1("Hello, type-safe HTML on Kitura!"))next()}Kitura.addHTTPServer(onPort:8080, with: router)Kitura.run()
Take it for a spin
We've included a sample Kitura application in this repo to show off its usage. To run the app immediately, simply do:
swift run HtmlKituraSupportExample
Open your browser to https://localhost:8080
The HTML for that page is constructed and rendered with swift-html!
If you want to run the app in Xcode so that you can play around with the HTML, try this: