Node.js的Lua实现 Luvit

fmms 12年前
     <p><strong>Luvit - Lua + UV + Jit = NodeJS re-implemented in Lua</strong></p>    <p>如上面标题所描述的,Luvit 相当于 luajit2 + libuv,编译成单个可执行文件,类似 Node.js ,可运行 .lua 文件。<br /> <br /> Node.js是一套用来编写高性能网络服务器的JavaScript工具包,一系列的变化由此开始。比较独特的是,Node.js会假设你是在POSIX环境下运行它Linux 或 Mac OS X。如果你是在Windows下,那就需要安装MinGW以获得一个仿POSIX的环境。在Node中,Http是首要的。Node为创建http服务器作了优化,所以你在网上看到的大部分示例和库都是集中在web上(http框架、模板库等)。<br /> </p>    <p>示例代码(创建一个HTTP服务器)</p>    <pre><code>-- Load the http library local HTTP = require("lib/http")  -- Create a simple nodeJS style hello-world server HTTP.create_server(function (req, res)   res:write_head(200, {     ["Content-Type"] = "text/plain",     ["Content-Length"] = "11"   })   res:write("Hello World")   res:finish() end):listen(8080)  -- Give a friendly message print("Server listening at http://localhost:8080/")</code></pre>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1323099608546" target="_blank">http://www.open-open.com/lib/view/home/1323099608546</a></p>