lua-users home
lua-l archive

Using Nanoki's HTTP engine directly

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


Nanoki sports it own HTTP engine... which one could use directly if so inclined. Attached is a basic 'HelloForm.lua' example illustrating form handling in HTTP.lua.
Usage:
% lua HelloForm.lua
Running at http://localhost:1080/
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
 <head>
 <meta http-equiv='content-type' content='text/html; charset=utf-8'/>
 <title>Hello</title>
 </head>
 <body>
 <p>Hello [v:name]!</p>
 <form method='post' action='/' accept-charset='utf-8' enctype='multipart/form-data'>
 <p><input type='text' name='name' value='[v:name]'/></p>
 <p><input name='submit' type='submit' value=' Submit '/></p>
 </form>
 <hr/>
 <pre>[v:request]</pre>
 <hr/>
 </body>
</html>

Attachment: HelloForm.lua
Description: Binary data

Cheers,
PA.

AltStyle によって変換されたページ (->オリジナル) /