2025-02-19 18:10:37 -03:00
|
|
|
local weblit = require('weblit')
|
2025-02-26 14:39:07 -03:00
|
|
|
local radon = require("./radon")
|
|
|
|
local fs = require("fs")
|
2025-02-19 18:10:37 -03:00
|
|
|
|
|
|
|
weblit.app
|
2025-02-26 14:39:07 -03:00
|
|
|
.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)
|
|
|
|
|
2025-02-26 14:39:07 -03:00
|
|
|
.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()
|