Lua实现的Node.js Luvit

Luvit 详细介绍

Luvit - Lua + UV + Jit = NodeJS re-implemented in Lua

如上面标题所描述的,Luvit 相当于 luajit2 + libuv,编译成单个可执行文件,类似 Node.js ,可运行 .lua 文件。

示例代码(创建一个HTTP服务器)

-- 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/")

博主花大量时间和精力整理了大前端最新前端视频教程,省去大家找资源的时间

有兴趣的可以点击下方文字访问博主淘宝网(感谢支持)或直接联系博主QQ:184009766

点击我,支持博主,前端视频教程

猜你喜欢

转载自blog.csdn.net/phj_88/article/details/81697539
今日推荐