From 98c839f868b5492ebba1a926c7d348878c7d9cc7 Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Sun, 9 Jun 2024 22:28:01 -0600 Subject: [PATCH] Make fullmoon work --- .gitignore | 2 ++ .init.lua | 10 ++++++++++ Makefile | 15 ++++++++++++--- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 67b7cf6..30c3ef3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ redbean*.com +*.db +.build \ No newline at end of file diff --git a/.init.lua b/.init.lua index 4e09522..992a754 100644 --- a/.init.lua +++ b/.init.lua @@ -1 +1,11 @@ LaunchBrowser() + +fm = require "fullmoon" +fm.setTemplate("hello", "Hello, {%& name %}") +fm.setRoute("/hello/:name", function(r) + return fm.serveContent("hello", {name = r.params.name}) + end) +fm.setTemplate("itworks", "

It works!

") +fm.setRoute("/", fm.serveContent("itworks")) +print "did some stuff" +fm.run() \ No newline at end of file diff --git a/Makefile b/Makefile index 1b661ce..18d638a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,16 @@ .PHONY: run -run: redbean/redbean-2.2.com - redbean/redbean-2.2.com -D . +run: .build/peachy.com + .build/peachy.com -redbean/redbean-2.2.com: +.PHONY: .build/peachy.com +.build/peachy.com: redbean/redbean-2.2.com + mkdir -p .build + # rm .build/* + cp redbean/redbean-2.2.com .build/peachy-noassets.com + zip -r .build/peachy-noassets.com .init.lua .lua + mv .build/peachy-noassets.com .build/peachy.com + + +.redbean/redbean-2.2.com: wget --directory-prefix redbean https://redbean.dev/redbean-2.2.com chmod a+x redbean/redbean-2.2.com