Awesome
nodish
A lightweight Lua equivalent to Node.js. .
Motivation / Target Audience
This framework might be for you, if you want node.js like API, but:
- You have very limited ressources (memory)
- You need a lua-ev backend
- You are interested in a "Lua-only" (>90%) implementation
Unlike luvit or LuaNode this project does NOT (yet) try to be a complete node.js port. Instead it tries to keep dependecies as minimal as possible to keep size small for embedded systems. To use nodish you need:
Interpreter
- luajit (or Lua + luaffi)
Lua modules
C libraries
- Any ljsyscall compatible libc
- libev
To reduce size further, you may be interested in squish.
NOTE: If you have no ressource problems, you should use a more robust and mature implementation like luvit or LuaNode or event better, just use the fantastic Node.js!
Examples
Echo Server
local net = require'nodish.net'
local process = require'nodish.process'
net.createServer(function(client)
client:pipe(client)
client:pipe(process.stdout)
end):listen(12345)
process.loop()
Echo Client
local net = require'nodish.net'
local process = require'nodish.process'
local client = net.connect(12345)
client:on('connect',function()
process.stdin:pipe(client)
client:pipe(process.stdout)
end)
process.loop()
Installation
Linux (Debian based)
sudo add-apt-repository ppa:mwild1/ppa -y
sudo apt-get update -y
sudo apt-get install luajit -y --force-yes
sudo apt-get install libev-dev
sudo apt-get install luarocks
git clone git://github.com/justincormack/ljsyscall.git
cd ljsyscall
sudo luarocks make rockspec/ljsyscall-scm-1.rockspec
cd ../
git clone http://github.com/lipp/nodish.git
cd nodish
sudo luarocks make rockspecs/nodish-scm-1.rockspec
OSX (with homebrew)
brew install luajit
brew install libev
brew install luarocks
git clone git://github.com/justincormack/ljsyscall.git
cd ljsyscall
sudo luarocks make rockspec/ljsyscall-scm-1.rockspec
cd ../
git clone http://github.com/lipp/nodish.git
cd nodish
sudo luarocks make rockspecs/nodish-scm-1.rockspec
Status
Module | Status | API | Remarks |
---|---|---|---|
net | Almost complete | net | |
events | Complete | events | |
process | Partial | process | |
buffer | Almost complete | buffer | add buffer.release and buffer.isReleased for better buffer reuse |