https://github.com/mantono/ktor-mustache
Use Mustahce effortless in Ktor
https://github.com/mantono/ktor-mustache
jvm kotlin ktor ktor-mustache mustache
Last synced: 2 months ago
JSON representation
Use Mustahce effortless in Ktor
- Host: GitHub
- URL: https://github.com/mantono/ktor-mustache
- Owner: mantono
- License: mit
- Created: 2018-11-03T14:51:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-09T21:38:03.000Z (over 5 years ago)
- Last Synced: 2025-03-17T19:02:23.781Z (2 months ago)
- Topics: jvm, kotlin, ktor, ktor-mustache, mustache
- Language: Kotlin
- Size: 81.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ktor-mustache
Use [Mustache](https://github.com/spullara/mustache.java) effortless in [Ktor](http://ktor.io/)### Example
```kotlin
routing {
// Install feature with optional config block
// Values shown below are default values
install(Mustache) {
// Set location for where templates are stored
this.resources = File("src/main/resources/templates")
this.bufferSize = 64
// Default values that is sent with all templates, unless overridden on specific routes
this.defaultValues = emptyMap()
}
get("/") {
// Use file test.mustache ('.mustache' can be omitted)
// with substitution 'bar' for variable 'foo'
call.respondTemplate("test") {
mapOf("foo" to "bar")
}
}
}
```