Giter Site home page Giter Site logo

lj-web's Introduction

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" [email protected].

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

Thanks

  • Chaoslawful (github.com/chaoslawful)
  • Agentzh (github.com/agentzh)

lj-web's People

Contributors

kindy avatar

Stargazers

Sohel Mia avatar lxw avatar Feng Lyu avatar orangleliu avatar afa avatar yingnierxiao avatar  avatar Chao’s avatar Maxim Nikolenko avatar doujiang24 avatar hyson avatar Anthony Scalisi avatar Yu Xiao avatar Yves Chan avatar Telman Yusupov avatar Gorila avatar 风之缘 avatar wolfg avatar Tony Han avatar 徐建 avatar Josh Feng avatar noodles avatar goroutine avatar muxueqz avatar Eric Zhang avatar  avatar Andy Huang avatar  avatar 404 avatar Rebill avatar jing avatar jayeeliu avatar  avatar Taylor Weibley avatar

Watchers

Taylor Weibley avatar  avatar Yichun Zhang avatar Wang, Xiaozhe avatar jing avatar  avatar James Cloos avatar goroutine avatar  avatar Anthony Scalisi avatar

lj-web's Issues

安装报错

安装时出现这样子的错误,麻烦球哥帮忙看看,多谢

sudo make install OPENRESTY_PREFIX=/opt/openresty
cc -bundle -undefined dynamic_lookup -o lib/posix_c.so deps/luaposix/lposix.o
cc: dynamic_lookup: No such file or directory
cc: unrecognized option '-bundle'
make: *** [lib/posix_c.so] Error 1

nginx version: ngx_openresty/1.2.6.6
built by gcc 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)
TLS SNI support enabled
configure arguments: --prefix=/opt/openresty/nginx --add-module=../ngx_devel_kit-0.2.18 --add-module=../iconv-nginx-module-0.10rc7 --add-module=../echo-nginx-module-0.42 --add-module=../xss-nginx-module-0.03rc9 --add-module=../ngx_coolkit-0.2rc1 --add-module=../set-misc-nginx-module-0.22rc8 --add-module=../form-input-nginx-module-0.07 --add-module=../encrypted-session-nginx-module-0.02 --add-module=../drizzle-nginx-module-0.1.4 --add-module=../ngx_postgres-1.0rc2 --add-module=../srcache-nginx-module-0.19 --add-module=../ngx_lua-0.7.15 --add-module=../headers-more-nginx-module-0.19 --add-module=../array-var-nginx-module-0.03rc1 --add-module=../memc-nginx-module-0.13rc3 --add-module=../redis2-nginx-module-0.09 --add-module=../redis-nginx-module-0.3.6 --add-module=../auth-request-nginx-module-0.2 --add-module=../rds-json-nginx-module-0.12rc10 --add-module=../rds-csv-nginx-module-0.05rc2 --with-ld-opt=-Wl,-rpath,/opt/libs/libdrizzle/lib:/opt/openresty/luajit/lib --with-http_ssl_module

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.