当前位置: 首页 > news >正文

发现一个nginx LUA开发Web App的框架

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

今天又发现个好东西 :Moochine


 

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

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

 

项目地址:https://github.com/appwilldev/moochine

 
 

 

 

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

request对象的属性和方法


 

 

 

--属性
method          = ngx.var.request_method    -- http://wiki.nginx.org/HttpCoreModule#.24request_method
schema          = ngx.var.schema            -- http://wiki.nginx.org/HttpCoreModule#.24scheme
host            = ngx.var.host              -- http://wiki.nginx.org/HttpCoreModule#.24host
hostname        = ngx.var.hostname          -- http://wiki.nginx.org/HttpCoreModule#.24hostname
uri             = ngx.var.request_uri       -- http://wiki.nginx.org/HttpCoreModule#.24request_uri
path            = ngx.var.uri               -- http://wiki.nginx.org/HttpCoreModule#.24uri
filename        = ngx.var.request_filename  -- http://wiki.nginx.org/HttpCoreModule#.24request_filename
query_string    = ngx.var.query_string      -- http://wiki.nginx.org/HttpCoreModule#.24query_string
user_agent      = ngx.var.http_user_agent   -- http://wiki.nginx.org/HttpCoreModule#.24http_HEADER
remote_addr     = ngx.var.remote_addr       -- http://wiki.nginx.org/HttpCoreModule#.24remote_addr
remote_port     = ngx.var.remote_port       -- http://wiki.nginx.org/HttpCoreModule#.24remote_port
remote_user     = ngx.var.remote_user       -- http://wiki.nginx.org/HttpCoreModule#.24remote_user
remote_passwd   = ngx.var.remote_passwd     -- http://wiki.nginx.org/HttpCoreModule#.24remote_passwd
content_type    = ngx.var.content_type      -- http://wiki.nginx.org/HttpCoreModule#.24content_type
content_length  = ngx.var.content_length    -- http://wiki.nginx.org/HttpCoreModule#.24content_length

headers         = ngx.req.get_headers()     -- http://wiki.nginx.org/HttpLuaModule#ngx.req.get_headers
uri_args        = ngx.req.get_uri_args()    -- http://wiki.nginx.org/HttpLuaModule#ngx.req.get_uri_args
post_args       = ngx.req.get_post_args()   -- http://wiki.nginx.org/HttpLuaModule#ngx.req.get_post_args
socket          = ngx.req.socket            -- http://wiki.nginx.org/HttpLuaModule#ngx.req.socket

--方法
request:read_body()                         -- http://wiki.nginx.org/HttpLuaModule#ngx.req.read_body
request: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_uri
request: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.redirect

response:finish()                           -- http://wiki.nginx.org/HttpLuaModule#ngx.eof
response:is_finished()
response:defer(func, ...)                   -- 在response返回后执行
 

支持 Multi-App 与 Sub-App

 

相关文章:

  • golang笔记——string
  • 【转】Android Support v4、v7、v13的区别和应用场景
  • 【HDOJ】4326 Game
  • js 定义类对象
  • Android 解决onInterceptTouchEvent只能拦截到Down事件
  • 本地使用SVN编辑发布远程SAE工程
  • Oracle_spatial的空间操作符介绍
  • 用JavaScript代码实现Excel表格的办法
  • 今天开始学习python
  • Robotium入门
  • permutation II (boss出来了)
  • Nginx在Window下的使用笔记
  • linux编程之GDB调试
  • 数组、指针
  • 架构师速成8.2-架构师要懂产品
  • 《深入 React 技术栈》
  • 【跃迁之路】【699天】程序员高效学习方法论探索系列(实验阶段456-2019.1.19)...
  • Android单元测试 - 几个重要问题
  • Apache Spark Streaming 使用实例
  • Docker入门(二) - Dockerfile
  • happypack两次报错的问题
  • HTML5新特性总结
  • Mysql数据库的条件查询语句
  • nginx 配置多 域名 + 多 https
  • php面试题 汇集2
  • Webpack 4 学习01(基础配置)
  • 分布式任务队列Celery
  • 基于 Ueditor 的现代化编辑器 Neditor 1.5.4 发布
  • 技术胖1-4季视频复习— (看视频笔记)
  • 看完九篇字体系列的文章,你还觉得我是在说字体?
  • 前端工程化(Gulp、Webpack)-webpack
  • 前嗅ForeSpider采集配置界面介绍
  • 微信小程序--------语音识别(前端自己也能玩)
  • 用Visual Studio开发以太坊智能合约
  • 白色的风信子
  • scrapy中间件源码分析及常用中间件大全
  • 微龛半导体获数千万Pre-A轮融资,投资方为国中创投 ...
  • ​2020 年大前端技术趋势解读
  • ​软考-高级-系统架构设计师教程(清华第2版)【第1章-绪论-思维导图】​
  • !! 2.对十份论文和报告中的关于OpenCV和Android NDK开发的总结
  • #define 用法
  • ${factoryList }后面有空格不影响
  • (二)构建dubbo分布式平台-平台功能导图
  • (附源码)springboot金融新闻信息服务系统 毕业设计651450
  • (五)大数据实战——使用模板虚拟机实现hadoop集群虚拟机克隆及网络相关配置
  • (转)mysql使用Navicat 导出和导入数据库
  • (转)德国人的记事本
  • .desktop 桌面快捷_Linux桌面环境那么多,这几款优秀的任你选
  • .NET Framework 4.6.2改进了WPF和安全性
  • .net通用权限框架B/S (三)--MODEL层(2)
  • .NET中使用Protobuffer 实现序列化和反序列化
  • @EnableConfigurationProperties注解使用
  • @RequestParam,@RequestBody和@PathVariable 区别
  • [20160807][系统设计的三次迭代]
  • [ajaxupload] - 上传文件同时附件参数值