napkin/main.lua

38 lines
758 B
Lua
Raw Normal View History

2025-02-19 18:10:37 -03:00
local weblit = require('weblit')
local radon = require("./radon")
local fs = require("fs")
2025-02-19 18:10:37 -03:00
weblit.app
.bind({ host = "127.0.0.1", port = 1337 })
2025-02-19 18:10:37 -03:00
-- Configure weblit server
.use(weblit.logger)
.use(weblit.autoHeaders)
.route(
{ path = "/static/:path:" },
weblit.static("static")
)
.route({ path = "/p/:post" }, function()
end)
.route({ path = "/@:blog" }, function(req, res)
local data = dofile("template/blog.lua")
res.body = radon.compile(data)
res.code = 200
res.headers["Content-Type"] = "text/html"
end)
.route({ path = "/@:blog/:post" }, function(req, res)
end)
.route({ path = "/" }, function(req, res)
end)
2025-02-19 18:10:37 -03:00
-- Start the server
.start()