diff options
-rw-r--r-- | guix-web/controller.scm | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/guix-web/controller.scm b/guix-web/controller.scm index bfa2f5e..ad91008 100644 --- a/guix-web/controller.scm +++ b/guix-web/controller.scm @@ -25,28 +25,28 @@ #:use-module (guix-web package) #:export (controller)) -(define (controller path) - (match path - ((GET) - (redirect '("packages"))) - ((GET "packages") - (render-html (all-packages))) - ((GET "packages.json") - (render-json (all-packages-json))) - ((GET "packages" name) - (match (string-split name #\.) - ((name ext) - (render-json - (if (string=? ext "json") - (view-package-json name) - '()))) - ((name) - (render-html (view-package name))))) - ((POST "packages" name "install") - (let ((package (car (find-packages-by-name name)))) - (if (package-install package) - (created) - (unprocessable-entity)))) - ((GET "librejs") - (render-html (librejs))) - (_ #f))) +(define controller + (match-lambda + ((GET) + (redirect '("packages"))) + ((GET "packages") + (render-html (all-packages))) + ((GET "packages.json") + (render-json (all-packages-json))) + ((GET "packages" name) + (match (string-split name #\.) + ((name ext) + (render-json + (if (string=? ext "json") + (view-package-json name) + '()))) + ((name) + (render-html (view-package name))))) + ((POST "packages" name "install") + (let ((package (car (find-packages-by-name name)))) + (if (package-install package) + (created) + (unprocessable-entity)))) + ((GET "librejs") + (render-html (librejs))) + (_ #f))) |