Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kindy/lj-web
lightweight web framework based on ngx_openresty
https://github.com/kindy/lj-web
Last synced: 3 months ago
JSON representation
lightweight web framework based on ngx_openresty
- Host: GitHub
- URL: https://github.com/kindy/lj-web
- Owner: kindy
- Created: 2013-01-14T17:38:58.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-09-23T15:29:49.000Z (over 11 years ago)
- Last Synced: 2024-02-13T21:42:43.356Z (12 months ago)
- Language: Lua
- Size: 213 KB
- Stars: 34
- Watchers: 10
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-resty - lj-web
README
# Lightweight Web Framework Based On ngx_openresty
Maybe you will like lapis( https://github.com/leafo/lapis ), it's also base on ngx_openresty
## Example
```
local web = require 'lj.web'web.route {'/hello/:name', function(req, resp, param)
resp:printf {'hello, %s!\n', param.name}
end}web.run()
```## How To Get Start
### install ngx_openresty first
quick step or see detail at: http://openresty.org/#Installation
```
# filesize: 2.9M
$ curl -O http://agentzh.org/misc/nginx/ngx_openresty-1.2.6.1.tar.gz
$ tar zxf ngx_openresty-1.2.6.1.tar.gz
$ cd ngx_openresty-1.2.6.1/
# you should use --with-luajit
# if you install other path than /usr/local/openresty, you should change the path in following step too
$ ./configure --with-luajit --prefix=/usr/local/openresty && make && sudo make install
```### install lj-web
```
# filesize: 28K
$ curl -O http://kindy.github.com/lj-web/files/lj-web-0.0.1rc1.tar.gz
$ tar zxf lj-web-0.0.1rc.tar.gz
$ cd lj-web-0.0.1rc1/
# please fix the openresty install path to match your system
$ sudo make install OPENRESTY_PREFIX=/usr/local/openresty
# I think you'd like to add the bin to you $PATH
```### try lj-web
the ngx_openresty version "python -m SimpleHTTPServer" (ss means "simple server")
```
# press ctrl+C to quit
$ lj-web ss
# or you want to use different port:
$ lj-web ss -l:9002
```try the example app
```
# you can try the example.lua app in the dist dir (press ctrl+C to quit):
# default port is 9090, and, it can not be change at this time, sorry for that.
$ lj-web run example.lua
# open a new shell:
$ curl -v localhost:9090/baidu
$ curl -v localhost:9090/hello/lj-web
```that's it.
## Copyright and License
This module is licensed under the BSD license.
Copyright (C) 2013, by "Kindy Lin" .
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
## See Also
* the ngx_openresty site: http://openresty.org
## Thanks
* Chaoslawful (github.com/chaoslawful)
* Agentzh (github.com/agentzh)