LapisLua 的 Web 框架

联合创作 · 2023-09-20

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
浏览 3
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报