Vanilla is An OpenResty Lua MVC Web Framework.
There are two ways to install:
make install
:
Vanilla support many configuration options, many of those option have default value.
You can use default installation but if your enviroment values different from which vanilla default, please config it with yours.
Especially the --openresty-path
option. you should make sure it's point to your turely OpenResty install path.
You can run command ./configure --help
to learn how to use those options.
Below is the installation of a simple example:
./configure --prefix=/usr/local/vanilla --openresty-path=/usr/local/openresty
make install
luarocks install
:
You can use luarocks to install vanilla, but three point should be clear:
Vanilla provide two commands vanilla
, and vanilla-console
.
vanilla
is for application building, service start, stop and so on.vanilla-console
is an interactive command line, you can use it for debugging, testing, Lua learning...Run vanilla
in command line, you can find command vanilla
provide three options.
vanilla
Vanilla v0.1.0-rc3, A MVC web framework for Lua powered by OpenResty.
Usage: vanilla COMMAND [ARGS] [OPTIONS]
The available vanilla commands are:
new [name] Create a new Vanilla application
start Starts the Vanilla server
stop Stops the Vanilla server
restart First Stops and then Starts the Vanilla servers
reload Reload nginx.conf of Vanilla server
Options:
--trace Shows additional logs
vanilla new app_name
cd app_name
vanilla start [--trace] -- default running in development environment.
-- under bash on linux
VA_ENV=production vanilla start [--trace] -- add VA_ENV to set the running environment.
-- under tcsh on BSD
setenv VA_ENV production ; vanilla start [--trace] -- add VA_ENV to set the running environment.
/Users/zj-git/app_name/ tree ./
./
├── application
│ ├── bootstrap.lua --application boot
│ ├── controllers
│ │ ├── error.lua --application error handling, dealing with corresponding business under this path error
│ │ └── index.lua --vanilla hello world
│ ├── library --local libs
│ ├── models
│ │ ├── dao --data handles for DB, APIs
│ │ │ └── table.lua
│ │ └── service --encapsulations of DAOs
│ │ └── user.lua
│ ├── nginx --openresy http phases
│ │ └── init.lua --init_by_lua demo
│ ├── plugins
│ └── views --one to one correspondence to controllers
│ ├── error --error handle view layout
│ │ └── error.html
│ └── index --index controller views
│ └── index.html
├── config
│ ├── application.lua --app basic configuration such as router,initialization settings...
│ ├── errors.lua --app error conf
│ ├── nginx.conf --nginx.conf skeleton
│ ├── nginx.lua --nginx settings like lua_code_cache.
│ ├── waf-regs --WAF rules
│ │ ├── args
│ │ ├── cookie
│ │ ├── post
│ │ ├── url
│ │ ├── user-agent
│ │ └── whiteurl
│ └── waf.lua --app WAF config
├── logs
│ └── hack --attack logs, keep path can be write
├── pub --app content_by_lua_file path
└── index.lua --entrance file
local IndexController = {}
function IndexController:index()
local view = self:getView()
local p = {}
p['vanilla'] = 'Welcome To Vanilla...'
p['zhoujing'] = 'Power by Openresty'
view:assign(p)
return view:display()
end
return IndexController
<!DOCTYPE html>
<html>
<body>
<img src="http://m1.sinaimg.cn/maxwidth.300/m1.sinaimg.cn/120d7329960e19cf073f264751e8d959_2043_2241.png">
<h1><a href = 'https://github.com/idevz/vanilla'>{{vanilla}}</a></h1><h5>{{zhoujing}}</h5>
</body>
</html>
To answer this question, we just need to see what Openresty has done and Vanilla has done.
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )