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

Commit

Permalink
Start using lanes instead of the current routers.
Browse files Browse the repository at this point in the history
  • Loading branch information
wmealing committed Oct 28, 2023
1 parent 0190bda commit 676475c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ $ rebar3 as test lfe test

TBD


## Roadmap [↟](#roadmap)

[~] Create a tutorial of basic HTMX used with LFE.
[x] Provide a simple working LFE web server that serves html.
[x] Provide an example of serving htmx from LFE.
[ ] Create a playground which serves up simple editable html page and a lfe handler.
[ ] Provide advanced examples of per user processes linked to a single page (advanced, probably after spawnfest).

## License [↟](#table-of-contents)

Apache License, Version 2.0
Expand Down
20 changes: 11 additions & 9 deletions priv/chapter1.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,18 @@ <h1 class="text-black-600 text-5xl font-bold">
</p>

<pre>
;; previous function headers here.
(('POST (list (binary ("chapter1-clicked")) )(= `#m(body ,body) req))
(progn
(let* ((headers (generate-headers))
(body (list (template:load "chapter1-post-response.html"))))
(barista:response 200 headers body))))
..

</pre>
;; previous matches removed here.
(('POST (list (binary (&quot;chapter1-clicked&quot;)) )(= `#m(body ,body) req))
(progn
(let* ((headers (generate-headers))
(body (list (binary &quot;&lt;b&gt; This is just a html fragment &lt;/b&gt;&quot;))))
(lfe_io:format &quot;headers: ~p~n&quot; `(,headers))
(barista:response 200 headers body))))
</pre>

<p class="py-5">
For the full example check out the source in the demo repo <a href="https://github.com/spawnfest/UntitledProject"> here. </a>
</p>
<p class="py-5 text-9xl">
<a href="/chapter1" hx-boost="true">← Previous Chapter</a> || <a href="/chapter2" hx-boost="true">Next Chapter →</a>
</p>
Expand Down
2 changes: 2 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
{lfe, "2.1.2"},
{ltest, "0.13.5"},
{barista, "0.3.4"},
{lanes, "0.3.3"},
{proper, "1.4.0"}

]}.

{plugins, [
Expand Down
2 changes: 1 addition & 1 deletion src/barista-routes.lfe
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
(('POST (list (binary ("chapter1-clicked")) )(= `#m(body ,body) req))
(progn
(let* ((headers (generate-headers))
(body (list (template:load "chapter1-post-response.html"))))
(body (list (binary "<b> This is just a html fragment </b>"))))
(lfe_io:format "headers: ~p~n" `(,headers))
(barista:response 200 headers body))))

Expand Down

0 comments on commit 676475c

Please sign in to comment.