diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index 8ef46ff..a313db7 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -198,6 +198,12 @@ class Main{ stats.addVisit("/") } + app.get("/admin/stats"){ + + it.json(stats.toJson()) + + } + app.get("/:name"){ //TODO monaco folder einzeln println("name") diff --git a/src/main/kotlin/Statistics.kt b/src/main/kotlin/Statistics.kt index 841ec24..fe8be9c 100644 --- a/src/main/kotlin/Statistics.kt +++ b/src/main/kotlin/Statistics.kt @@ -34,9 +34,11 @@ class Statistics(var f: File){ } private fun save(){ - f.writeText(adapter.toJson(statistic)) + f.writeText(toJson()) } + fun toJson() = adapter.toJson(statistic) + data class Statistic(var visits: Int, var visitsPerSite: MutableMap){ }