peachy/assets/.init.lua

19 lines
515 B
Lua

-- LaunchBrowser()
local migrate = require "migrate"
local DB_FILENAME = "peachy.db"
sqlite3 = require "lsqlite3"
local db = sqlite3.open(DB_FILENAME)
db:exec("PRAGMA journal_mode=WAL")
db:exec("PRAGMA foreign_keys")
migrate.migrate(db)
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()