LapisLua 的 Web 框架
Lapis 是一个用来构建 Web 一个用的框架,使用 MoonScript 或者 Lua 开发,运行于 OpenResty。
示例代码:
lapis = require "lapis"
class extends lapis.Application
-- Define a basic pattern that matches /
"/": =>
profile_url = @url_for "profile", name: "leafo"
@html ->
h2 "Welcome!"
text "Go to my "
a href: profile_url, "profile"
-- Define a named route pattern with a variable called name
[profile: "/:name"]: =>
@html ->
div class: "profile", ->
text "Welcome to the profile of ", @params.name
评论
