Browse Source

Implement API version endpoint.

* genenetwork.lisp (:genenetwork): Import :current-commit from :legit
and :encode-json-to-string from :cl-json.
(version): New hunchentoot handler.
* guix.scm: Add sbcl-cl-json and sbcl-legit to manifest.
main
Arun Isaac 5 months ago
parent
commit
6043a91306
Signed by untrusted user: arunisaac GPG Key ID: 2E25EE8B61802BB3
  1. 10
      genenetwork.lisp
  2. 2
      guix.scm

10
genenetwork.lisp

@ -1,9 +1,19 @@
(defpackage :genenetwork
(:use :common-lisp :hunchentoot)
(:import-from :legit :current-commit)
(:import-from :cl-json :encode-json-to-string)
(:export :main))
(in-package :genenetwork)
(hunchentoot:define-easy-handler (version :uri "/api/version") ()
(setf (hunchentoot:content-type*) "application/json; charset=utf-8")
(encode-json-to-string
`((version . ,(asdf:system-version (asdf:find-system :genenetwork)))
(commit . ,(let ((repository (make-instance 'legit:repository
:location (sb-posix:getcwd))))
(current-commit repository))))))
(hunchentoot:define-easy-handler (home :uri "/") ()
(setf (hunchentoot:content-type*) "text/plain; charset=utf-8")
"Hello World!")

2
guix.scm

@ -2,4 +2,4 @@
(gnu packages lisp-xyz))
(packages->manifest
(list sbcl sbcl-hunchentoot))
(list sbcl sbcl-cl-json sbcl-hunchentoot sbcl-legit))
Loading…
Cancel
Save