Skip to content

Commit 829fdd3

Browse files
committed
Add endpoint ping
1 parent 02c2243 commit 829fdd3

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,28 @@ curl 'https://glosa.example:4000/api/v1/captcha/?url=https://glosa.example/best-
293293
"token": ""
294294
}
295295
```
296+
297+
### Check if he is alive
298+
299+
GET: Simple answer to check that the service is working.
300+
301+
``` sh
302+
/api/v1/ping/
303+
```
304+
305+
#### Example
306+
307+
``` sh
308+
curl 'https://glosa.example:4000/api/v1/ping/'
309+
```
310+
311+
#### Success response
312+
313+
``` json
314+
{
315+
"ping": "pong"
316+
}
317+
```
296318
---
297319

298320
## Manager script

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject glosa "1.0.5"
1+
(defproject glosa "1.0.6"
22
:description "glosa"
33
:url "https://github.com/tanrax/glosa"
44
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"

src/glosa/urls.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
(context api-prefix []
1212
(GET "/comments/" [] view-public/get-comments)
1313
(POST "/comments/" [] view-public/add-comment)
14-
(GET "/captcha/" [] view-public/get-captcha)))
14+
(GET "/captcha/" [] view-public/get-captcha)
15+
(GET "/ping/" [] view-public/pong)))
1516

1617
(defroutes resources-routes
1718
;; Resources (statics)

src/glosa/views/public.clj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
[req]
2828
(render-JSON req (assoc {} :token (captcha/get-token (-> req :params :url)))))
2929

30+
(defn pong
31+
"Gives a simple message to record his abilities to play ping pong while he is alive"
32+
[req]
33+
(render-JSON req {:ping "pong"}))
34+
3035
(defn status-404
3136
"Page 404"
3237
[req]

0 commit comments

Comments
 (0)