Skip to content

Commit

Permalink
Added Stats endpoint (not secure yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
rpanic committed Mar 19, 2019
1 parent 7e71b0b commit a5eb928
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/Statistics.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Int>){
}
Expand Down

0 comments on commit a5eb928

Please sign in to comment.