diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2018-02-17 13:55:55 -0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2018-02-17 13:55:55 -0200 |
commit | 98056e815a6dcd36d7377d3cd823a4aaf5a3d9fa (patch) | |
tree | 61f453e1b21634e0f2d740ff61091d182e145184 /src/clj/queue_api/routes/services.clj | |
download | queue-api-98056e815a6dcd36d7377d3cd823a4aaf5a3d9fa.tar.gz queue-api-98056e815a6dcd36d7377d3cd823a4aaf5a3d9fa.tar.bz2 queue-api-98056e815a6dcd36d7377d3cd823a4aaf5a3d9fa.zip |
Initial commit
Diffstat (limited to 'src/clj/queue_api/routes/services.clj')
-rw-r--r-- | src/clj/queue_api/routes/services.clj | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/clj/queue_api/routes/services.clj b/src/clj/queue_api/routes/services.clj new file mode 100644 index 0000000..cc8ac04 --- /dev/null +++ b/src/clj/queue_api/routes/services.clj @@ -0,0 +1,44 @@ +(ns queue-api.routes.services + (:require [ring.util.http-response :refer :all] + [compojure.api.sweet :refer :all] + [schema.core :as s])) + +(defapi service-routes + {:swagger {:ui "/swagger-ui" + :spec "/swagger.json" + :data {:info {:version "1.0.0" + :title "Sample API" + :description "Sample Services"}}}} + + (context "/api" [] + :tags ["thingie"] + + (GET "/plus" [] + :return Long + :query-params [x :- Long, {y :- Long 1}] + :summary "x+y with query-parameters. y defaults to 1." + (ok (+ x y))) + + (POST "/minus" [] + :return Long + :body-params [x :- Long, y :- Long] + :summary "x-y with body-parameters." + (ok (- x y))) + + (GET "/times/:x/:y" [] + :return Long + :path-params [x :- Long, y :- Long] + :summary "x*y with path-parameters" + (ok (* x y))) + + (POST "/divide" [] + :return Double + :form-params [x :- Long, y :- Long] + :summary "x/y with form-parameters" + (ok (/ x y))) + + (GET "/power" [] + :return Long + :header-params [x :- Long, y :- Long] + :summary "x^y with header-parameters" + (ok (long (Math/pow x y)))))) |