From 54a61a11a8809c23f4606a7d73327e44900d71c2 Mon Sep 17 00:00:00 2001 From: Alexis Hernandez Date: Thu, 3 Jan 2019 20:04:08 -0700 Subject: [PATCH] server: Prepare "GET /maintenance" endpoint This is useful for running occasional maintenance tasks. --- .../app/controllers/MaintenanceController.scala | 17 +++++++++++++++++ server/conf/routes | 1 + 2 files changed, 18 insertions(+) create mode 100644 server/app/controllers/MaintenanceController.scala diff --git a/server/app/controllers/MaintenanceController.scala b/server/app/controllers/MaintenanceController.scala new file mode 100644 index 0000000..cbb17ff --- /dev/null +++ b/server/app/controllers/MaintenanceController.scala @@ -0,0 +1,17 @@ +package controllers + +import controllers.common.{MyJsonController, MyJsonControllerComponents} +import javax.inject.Inject +import org.scalactic.Good +import play.api.libs.json.JsObject + +import scala.concurrent.Future + +class MaintenanceController @Inject() ( + components: MyJsonControllerComponents) + extends MyJsonController(components) { + + def run() = public { _ => + Future.successful(Good(JsObject.empty)) + } +} diff --git a/server/conf/routes b/server/conf/routes index 547b3bf..06c8969 100644 --- a/server/conf/routes +++ b/server/conf/routes @@ -4,6 +4,7 @@ # ~~~~ GET /health controllers.HealthController.check() +# GET /maintenance controllers.MaintenanceController.run() GET /transactions/:txid controllers.TransactionsController.getTransaction(txid: String) GET /transactions/:txid/raw controllers.TransactionsController.getRawTransaction(txid: String)