common-node基于Fibers的同步CommonJS兼容层

同步风格的 Node.js 模块开发,common-node 用得还挺顺。它是个基于fibers的 CommonJS 兼容层,适合不太想写回调或者 Promise 的朋友。你直接写同步代码,逻辑清晰,尤其适合快速做点 CRUD 小应用。

fibers其实就是模拟多线程那一套,让你在单线程里写出多线程的感觉。比如数据库操作、文件读写这些,平时得用async/await,现在直接同步写,效率也不差,代码更整洁。

我试了下,用它跑一个本地 web 小服务,还真挺流畅。加上 CommonJS 风格,用模块方式组织代码也没什么适应成本。要是你平时写 Node.js 习惯了同步流程,这玩意儿会让你省不少事。

想了解相关用法,可以顺便看看 Titanium 的 CommonJS 实现Node.js CRUD 应用博客,思路差不多,风格统一。

如果你正打算写个轻量 CRUD 项目,又不想搞太多异步逻辑,不妨试试这个common-node,小而巧,挺顺手。

zip
common-node.zip 预估大小:90个文件
folder
common-node-master 文件夹
file
.gitignore 14B
file
package.json 924B
folder
bin 文件夹
file
common-node 102B
file
.travis.yml 38B
folder
doc 文件夹
folder
httpclient 文件夹
file
index.html 14KB
folder
assert 文件夹
file
index.html 22KB
folder
static 文件夹
file
jquery.js 160KB
file
style.css 566B
file
jsdoc.css 1KB
file
jsdoc.js 2KB
folder
all 文件夹
file
index.html 2KB
file
index.html 5KB
folder
jsgi 文件夹
file
index.html 5KB
folder
system 文件夹
file
index.html 13KB
folder
io 文件夹
file
index.html 61KB
folder
binary 文件夹
file
index.html 100KB
folder
fs-base 文件夹
file
index.html 88KB
folder
test 文件夹
file
index.html 4KB
folder
tools 文件夹
folder
jsdoc 文件夹
file
hosted.html 607B
file
static.html 607B
file
style.css 566B
file
jsdoc.css 1KB
folder
examples 文件夹
file
sleep.js 267B
file
chat.js 481B
file
traceur.js 144B
file
twitter.js 1KB
file
http.js 413B
file
spawn.js 462B
file
static.js 296B
file
hello.js 154B
file
base64.js 3KB
file
README.md 12KB
folder
lib 文件夹
file
httpclient.js 8KB
file
all.js 294B
file
global.js 1KB
file
subprocess.js 7KB
file
system.js 3KB
file
httpserver.js 3KB
file
socket.js 6KB
file
binary.js 29KB
file
run.js 3KB
file
test.js 3KB
file
io.js 18KB
file
console.js 2KB
folder
ringo 文件夹
file
httpclient.js 15KB
file
fs-base.js 26KB
file
assert.js 3KB
folder
benchmarks 文件夹
folder
buffer-alloc 文件夹
file
ringo.js 370B
file
node.js 256B
file
common-node.js 230B
folder
file-read 文件夹
file
ringo.js 276B
file
node.js 310B
file
common-node.js 296B
folder
file-stream 文件夹
file
ringo.js 268B
file
node.js 511B
file
common-node.js 282B
folder
set-timeout 文件夹
file
ringo.js 211B
file
node.js 159B
file
common-node.js 140B
file
run 1KB
file
run.js 3KB
folder
no-alloc 文件夹
file
ringo.js 361B
file
node.js 430B
file
common-node.js 373B
file
graph 2KB
folder
hello-world 文件夹
file
ringo.js 241B
file
node.js 181B
file
common-node.js 159B
folder
string-alloc 文件夹
file
ringo.js 421B
file
node.js 346B
file
common-node.js 339B
folder
test 文件夹
file
all.js 387B
file
subprocess.js 4KB
file
http.js 6KB
file
io.js 7KB
file
jsgi.js 348B
folder
binary 文件夹
file
all.js 331B
file
bytestring-tests.js 8KB
file
bytearray-tests.js 10KB
file
bytearray-encodings-tests.js 3KB
file
bytestring-encodings-tests.js 3KB
folder
fs-base 文件夹
file
all.js 389B
file
dirname.js 603B
file
main.js 2KB
file
resolve.js 1KB
file
iterator.js 3KB
file
extension.js 1015B
file
relative.js 1KB
file
path.js 1KB
file
normal.js 880B
...
zip 文件大小:155.13KB