aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/App.kt
diff options
context:
space:
mode:
authorMarvin Borner2019-04-04 15:57:07 +0200
committerMarvin Borner2019-04-04 15:57:07 +0200
commitfb58f161a5036e3f1fdc040679b6ee9efe22ade2 (patch)
tree03affd2c35249e98220dd238390984033c18f593 /src/main/kotlin/App.kt
parentb71c055a8a198a1071b5905904096630aba98361 (diff)
Added hot reloading of rocker templates
Diffstat (limited to 'src/main/kotlin/App.kt')
-rw-r--r--src/main/kotlin/App.kt8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main/kotlin/App.kt b/src/main/kotlin/App.kt
index a9e2018..327dec4 100644
--- a/src/main/kotlin/App.kt
+++ b/src/main/kotlin/App.kt
@@ -1,6 +1,7 @@
package space.anity
import com.fizzed.rocker.*
+import com.fizzed.rocker.runtime.*
import io.javalin.*
import io.javalin.core.util.*
import io.javalin.rendering.*
@@ -14,6 +15,8 @@ val db = DatabaseController()
fun main() {
val app = Javalin.create().enableStaticFiles("../resources/").start(7000)
+ // Set up templating
+ RockerRuntime.getInstance().isReloading = true
JavalinRenderer.register(
FileRenderer { filepath, model -> Rocker.template(filepath).bind(model).render().toString() }, ".rocker.html"
)
@@ -77,8 +80,3 @@ fun upload(ctx: Context) {
throw BadRequestResponse("Error: Please enter a filename.")
}
}
-
-
-
-
-