peachy/assets/.init.lua

18 lines
485 B
Lua
Raw Normal View History

2024-06-10 04:50:33 +00:00
-- LaunchBrowser()
2024-06-10 04:28:01 +00:00
2024-06-10 23:40:10 +00:00
local migrate = require "migrate"
2024-07-06 17:41:55 +00:00
local DB_FILENAME = "peachy.db"
sqlite3 = require "lsqlite3"
local db = sqlite3.open(DB_FILENAME)
db:exec("PRAGMA journal_mode=WAL;")
migrate.migrate(db)
2024-06-10 23:40:10 +00:00
2024-06-10 04:28:01 +00:00
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", "<h1>It works!</h1>")
fm.setRoute("/", fm.serveContent("itworks"))
fm.run()