采用MoonScript編寫的Web框架:Lapis

jopen 10年前發布 | 14K 次閱讀 Lapis Web框架

Lapis是一個采用MoonScript 或 Lua來開發Web應用的框架,運行在一個Nginx定制版 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

@html ->
  div class: "profile", ->
    text "Welcome to the profile of ", @params.name</pre> <p><strong>項目主頁:</strong><a href="http://www.baiduhome.net/lib/view/home/1400121567082" rel="nofollow" target="_blank">http://www.baiduhome.net/lib/view/home/1400121567082</a></p>
 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!