lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Here is an example on how to run Mercury with Nanoki's HTTP engine [1],
> using it's build in TCPServer [2] and a WSAPI handler [3]:
>
> local HTTP = require( 'HTTP' )
> local TCPServer = require( 'TCPServer' )
> local WSAPI = require( 'WSAPI' )
>
> HTTP[ '.*' ] = WSAPI( require( 'greetings' ).run )
> TCPServer( '127.0.0.1', 1080 )( HTTP )

This of course applies to other WSAPI apps as well. The following code
will run Sputnik on top of Nanoki's HTTP engine:

    local HTTP = require( 'HTTP' )
    local TCPServer = require( 'TCPServer' )
    local WSAPI = require( 'WSAPI' )
    HTTP[ '.*' ] = WSAPI( loadfile("sputnik.ws")() )
    TCPServer( '127.0.0.1', 1080 )( HTTP )

There is something to be said for standardization!

  - yuri