Welcome! Log In Create A New Profile

Advanced

Re: Catch ALL requests by LUA-script

May 02, 2011 12:11AM
Maybe slightly off-topic but then maybe it is useful for you (andiL) or someone else.

Before i start, @agentzh: every ?nth request, one of nginx (0.8.54.4rc2-jit2beta6) worker processes segfaults, is this behaviour related to the pcre issue? have not patched it yet.. ah and thank you *very* much for giving nginx this all new powers!! ((:

Ok, im a long time nginx/redis/ruby user and this are my first steps with lua and a lightweight (M)VC framework around three core "classes", which uses haml for templates/layout and markdown for text processing (5 minute ffi discount binding), drizzle and redis for data and redis also for caching. Successfully running a little app with it. yay! *.* For now i can give you some snippets just to show some basic aspects, ill release a fully working example sometime soon, if the segfaults doesnt belong to the pcre-issue ill try to debug that too.


Below ill use luasql, instead you can use ngx.location.capture("/some-internal-rds-json") and lua-yajl, but this approach ends as soon as you want INSERT followed by LAST_INSERT_ID() or other complex queries/transactions (as long as libdrizzle has no support for multiple queries, maybe this is not the best option to go with, ive tried alternatives and workarounds, but for now this is what *I* want).

At the moment i do not need an ORM for my data, but have already done some functions for both rds_json and luasql. redis has some commands exposed in nginx.conf for easy access with lua (: The core classes:

Request; which contains several ngx.var wrappers (for nil instead of '' for empty keys), present(str), simple cookie/session/login, before/after filters, haml/markdown rendering, etc..

MethodRequest < Request; which calls functions for HTTP Methods aka GET, POST alike..
and finally Resource < MethodRequest; which has an Rails-ActionController-like interface.


Greetz
# HTML

--- ATTACHMENT ---

ookeh to bad no code formatting...?

http://exc.eu/paste/deadbeaf.txt
Subject Author Posted

Catch ALL requests by LUA-script

andiL March 01, 2011 02:34AM

Re: Catch ALL requests by LUA-script

agentzh March 01, 2011 03:42AM

Re: Catch ALL requests by LUA-script

andiL March 01, 2011 04:53AM

Re: Catch ALL requests by LUA-script

agentzh March 01, 2011 06:14AM

Re: Catch ALL requests by LUA-script

andiL March 01, 2011 07:52AM

Re: Catch ALL requests by LUA-script

HowToMeetLadies May 02, 2011 12:11AM

Re: Catch ALL requests by LUA-script

agentzh May 03, 2011 10:56PM

Re: Catch ALL requests by LUA-script

HowToMeetLadies May 04, 2011 08:05PM

Re: Catch ALL requests by LUA-script

HowToMeetLadies May 05, 2011 12:29PM

Re: Catch ALL requests by LUA-script

agentzh May 04, 2011 11:22PM

Re: Catch ALL requests by LUA-script

agentzh May 06, 2011 12:28AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 68
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready