From 9e985ed69cc0d216e23824cef826bfd07d7704bc Mon Sep 17 00:00:00 2001 From: Wade Mealing Date: Mon, 30 Oct 2023 04:48:30 +1000 Subject: [PATCH] Exploring methods to determine how to get this working. --- priv/template-lfe.html | 7 +++++-- src/barista-routes.lfe | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/priv/template-lfe.html b/priv/template-lfe.html index e79142e..4c1943e 100644 --- a/priv/template-lfe.html +++ b/priv/template-lfe.html @@ -1,7 +1,10 @@ diff --git a/src/barista-routes.lfe b/src/barista-routes.lfe index bfd45db..ef70f3c 100644 --- a/src/barista-routes.lfe +++ b/src/barista-routes.lfe @@ -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") @@ -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