snark/examples/document/src/jvmMain/kotlin/main.kt

24 lines
634 B
Kotlin
Raw Normal View History

2024-04-16 17:46:00 +03:00
import io.ktor.server.application.Application
import io.ktor.server.cio.CIO
import io.ktor.server.engine.embeddedServer
2024-04-28 15:39:56 +03:00
import space.kscience.dataforge.meta.Meta
2024-04-16 17:46:00 +03:00
import space.kscience.dataforge.names.asName
import space.kscience.snark.html.document.document
import space.kscience.snark.html.document.fragment
@Suppress("unused")
2024-04-28 15:39:56 +03:00
fun Application.documents() = snarkApplication {
document("loremIpsum".asName(), Meta { "metaValue" put "Hello world!" }) {
fragment("chapter1")
fragment("chapter2")
fragment("chapter3")
2024-04-16 17:46:00 +03:00
}
}
fun main() {
embeddedServer(CIO) {
2024-04-28 15:39:56 +03:00
documents()
2024-04-16 17:46:00 +03:00
}.start(true)
}