Skip to content

Commit

Permalink
Reporting server-side integrated
Browse files Browse the repository at this point in the history
  • Loading branch information
mishajw committed Apr 19, 2016
1 parent 0b0879e commit cfca847
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/controllers/Application.scala
Expand Up @@ -138,4 +138,21 @@ class Application extends Controller {
"error" -> JString(errorMsg))
)))
}

def report = Action(parse.tolerantFormUrlEncoded) { request =>
try {
request.body.get("report").map(_.head) match {
case Some(report) =>
log.info(s"Report received: $report")
Ok("Report received")
case None =>
log.info("Report sent without report")
BadRequest("Report not passed")
}
} catch {
case e: Throwable =>
log.error("Got error getting report", e)
errorJson("Error receiving report")
}
}
}
2 changes: 2 additions & 0 deletions conf/routes
Expand Up @@ -9,5 +9,7 @@ GET /search/:start/:end/$search<[A-Za-z0-9_]*> controllers.Application.
GET /:start/:end controllers.Application.indexWithDates(start, end)
GET /:start/:end/$search<[A-Za-z0-9_]*> controllers.Application.indexWithSearch(start, end, search)

POST /report controllers.Application.report

# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)

0 comments on commit cfca847

Please sign in to comment.