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

Commit

Permalink
Exploring methods to determine how to get this working.
Browse files Browse the repository at this point in the history
  • Loading branch information
wmealing committed Oct 29, 2023
1 parent c200e6e commit 9e985ed
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
7 changes: 5 additions & 2 deletions priv/template-lfe.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

<textarea name="user-lfe" rows="30" cols="120">
;; you can do multi matches here, dont forget.
(defun demo-handler (method path (= `#m(body ,body) req))
(defmodule users-lfe
(export (demo-handler 3)))

;; you can do multi matches here, dont forget.
(defun demo-handler (method path req)
(barista-response:ok (erlang:binary_to_list (template:load "demo-response.html"))))
</textarea>

Expand Down
18 changes: 14 additions & 4 deletions src/barista-routes.lfe
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
(defmodule barista-routes
(export (do 1)
(handle 3)
(validate 2)))
(validate 2)
(compile-data 1)
(compile-file 1)
(write-to-file 2)
))

(include-lib "include/macros.lfe")
(include-lib "logjam/include/logjam.hrl")
Expand All @@ -17,12 +21,18 @@

;; write data to a file.
(defun write-to-file (filename data)
(file:write_file "priv/user/user-demo.lfe" data ))
(file:write_file filename data ))


;;compile a file
(defun compile-file (filename)
(: lfe-shell c filename))

;; compile it.
(defun compile-data (data)
(write-to-file "priv/user/user-demo.lfe" data)
(lfe-shell:c "priv/user/user-demo.lfe"))
(write-to-file "/tmp/user-demo.lfe" data)
(compile-file "/tmp/user-demo.lfe"))


(defun validate (id req)
;; TODO: implement form validation
Expand Down

0 comments on commit 9e985ed

Please sign in to comment.