Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 56202c7

Browse files
committed
Added ping/pong messaging to the rest api.
1 parent c19073e commit 56202c7

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/main/scala/org/codeoverflow/chatoverflow/ui/web/rest/config/ConfigController.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ class ConfigController(implicit val swagger: Swagger) extends JsonServlet with C
2626
}
2727
}
2828

29+
post("/ping", operation(postPing)) {
30+
authKeyRequired {
31+
ResultMessage(success = true, "pong")
32+
}
33+
}
34+
2935
// Is this even a thing?
3036
post("/exit", operation(postExit)) {
3137
authKeyRequired {

src/main/scala/org/codeoverflow/chatoverflow/ui/web/rest/config/ConfigControllerDefinition.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ trait ConfigControllerDefinition extends SwaggerSupport with TagSupport with Aut
2424
description "Shutdown the framework in the next second if a correct auth key is supplied."
2525
parameter authHeader
2626
tags controllerTag)
27+
val postPing: OperationBuilder =
28+
(apiOperation[ResultMessage]("postPing")
29+
summary "Used to check if the framework is still alive."
30+
description "Retrieves a empty ping message (with auth key required) and returns pong."
31+
parameter authHeader
32+
tags controllerTag)
2733
val getLogin: OperationBuilder =
2834
(apiOperation[Boolean]("getLogin")
2935
summary "Returns if the framework is already loaded."

0 commit comments

Comments
 (0)