Re:Fixing the callback spaghetti in node.js
by SomeCallMeTim on Thursday September 29, 2011 @12:06PM
(#3052997)
No, it's pretty easy. An example:
local doc = ngx.location.capture( "/couchdb/hamster/"..uid );
This queries the local CouchDB for a particular user record, and stores it in a local variable.
From the nginx wiki:
> Unlike Apache's mod_lua and Lighttpd's mod_magnet, Lua code written atop this module can be 100% non-blocking on network traffic as long as you use the ngx.location.capture or ngx.location.capture_multi interfaces to let the nginx core do all your requests to mysql, postgresql, memcached, redis, upstream http web services, and etc etc etc (see HttpDrizzleModule, ngx_postgres, HttpMemcModule, HttpRedis2Module and HttpProxyModule modules for details).
Is that talk-via-nginx-commands thing cumbersome in practice?