打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
发现一个nginx LUA开发Web App的框架
2013-08-13 00:10 2885人阅读 评论(3) 收藏 举报

目录(?)[+]

nginx是个好东西, nginx的openrtsy发行版本更是个好东西。

今天又发现个好东西 :Moochine

MOOCHINE - 一个简单的轻量级的web framework, 基于ngx_OpenResty(ngx_lua,ttp://openresty.org) 做的框架,

使用例子  https://github.com/appwilldev/moochine-demo



可以让我们构建WebApp 更加的简单,具体使用方法请看具体的 moochine-demo

request对象的属性和方法


--属性method          = ngx.var.request_method    -- http://wiki.nginx.org/HttpCoreModule#.24request_methodschema          = ngx.var.schema            -- http://wiki.nginx.org/HttpCoreModule#.24schemehost            = ngx.var.host              -- http://wiki.nginx.org/HttpCoreModule#.24hosthostname        = ngx.var.hostname          -- http://wiki.nginx.org/HttpCoreModule#.24hostnameuri             = ngx.var.request_uri       -- http://wiki.nginx.org/HttpCoreModule#.24request_uripath            = ngx.var.uri               -- http://wiki.nginx.org/HttpCoreModule#.24urifilename        = ngx.var.request_filename  -- http://wiki.nginx.org/HttpCoreModule#.24request_filenamequery_string    = ngx.var.query_string      -- http://wiki.nginx.org/HttpCoreModule#.24query_stringuser_agent      = ngx.var.http_user_agent   -- http://wiki.nginx.org/HttpCoreModule#.24http_HEADERremote_addr     = ngx.var.remote_addr       -- http://wiki.nginx.org/HttpCoreModule#.24remote_addrremote_port     = ngx.var.remote_port       -- http://wiki.nginx.org/HttpCoreModule#.24remote_portremote_user     = ngx.var.remote_user       -- http://wiki.nginx.org/HttpCoreModule#.24remote_userremote_passwd   = ngx.var.remote_passwd     -- http://wiki.nginx.org/HttpCoreModule#.24remote_passwdcontent_type    = ngx.var.content_type      -- http://wiki.nginx.org/HttpCoreModule#.24content_typecontent_length  = ngx.var.content_length    -- http://wiki.nginx.org/HttpCoreModule#.24content_lengthheaders         = ngx.req.get_headers()     -- http://wiki.nginx.org/HttpLuaModule#ngx.req.get_headersuri_args        = ngx.req.get_uri_args()    -- http://wiki.nginx.org/HttpLuaModule#ngx.req.get_uri_argspost_args       = ngx.req.get_post_args()   -- http://wiki.nginx.org/HttpLuaModule#ngx.req.get_post_argssocket          = ngx.req.socket            -- http://wiki.nginx.org/HttpLuaModule#ngx.req.socket--方法request:read_body()                         -- http://wiki.nginx.org/HttpLuaModule#ngx.req.read_bodyrequest:get_uri_arg(name, default)request:get_post_arg(name, default)request:get_arg(name, default)request:get_cookie(key, decrypt)request:rewrite(uri, jump)                  -- http://wiki.nginx.org/HttpLuaModule#ngx.req.set_urirequest:set_uri_args(args)                  -- http://wiki.nginx.org/HttpLuaModule#ngx.req.set_uri_args

response对象的属性和方法

--属性headers         = ngx.header                -- http://wiki.nginx.org/HttpLuaModule#ngx.header.HEADER--方法response:set_cookie(key, value, encrypt, duration, path)response:write(content)response:writeln(content)response:ltp(template,data)response:redirect(url, status)              -- http://wiki.nginx.org/HttpLuaModule#ngx.redirectresponse:finish()                           -- http://wiki.nginx.org/HttpLuaModule#ngx.eofresponse:is_finished()response:defer(func, ...)                   -- 在response返回后执行

支持 Multi-App 与 Sub-App

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
安装成功的nginx如何添加未编译安装模块
Nginx直接post请求获取静态文件
ETag使用效果对比及经验分享(附ETag配置教程)(2)
centos编译安装nginx,及其编译参数解析
第二章 Nginx+Lua开发入门
网站数据统计分析中的日志收集原理及其实现
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服