Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
Include the macros so this runs in CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
wmealing committed Oct 29, 2023
1 parent daa6331 commit 62232a2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/macros.lfe
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(defmacro defroutes body
"This macro takes the elements of a valid set of routes and transforms them
into a series of function heads which comprise the final output, the barista
handler function 'handle/3'."
`(defun handle
,@(lanes.common:compile-routes body)))

(defun --loaded-barista-route-macros-- ()
"This is just a dummy function for display purposes when including from the
REPL (the last function loaded has its name printed in stdout).
This function needs to be the last one in this include."
'ok)
15 changes: 15 additions & 0 deletions src/barista-routes.lfe
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@
(logger:debug "This is getting old, why doesnt this match ")
(barista-response:ok (erlang:binary_to_list (template:load "index.html")))))

('GET #"/chapter1"
(progn
(logger:info "This is getting old, why doesnt this match ")
(barista-response:ok (erlang:binary_to_list (template:load "chapter1.html")))))

('POST #"/chapter1-clicked"
(progn
(logger:emergency "This is an emergency!")
(barista-response:ok "<b> Hello from Lisp Flavored erlang </b>")))

('GET #"/chapter2"
(progn
(logger:info "I kinda expected this to appear")
(barista-response:ok (erlang:binary_to_list (template:load "chapter1.html")))))

;; single order operations
('POST #"/order"
(progn
Expand Down

0 comments on commit 62232a2

Please sign in to comment.