NodeJS 经常使用模块积累

cluster&forever

cluster & forever

虽然 nodejs 原生已经提供了 cluster 模块,大部分状况下能够知足咱们的基本需求,但这两个模块 cluster 和 forever 都提供了更强大的功能。javascript

cluster 及 forever 都能让你的 nodejs 应用的管理更加方便,好比启动、重启、中止你的应用。css

他们也均可以保证应用的稳定性,若是你的 nodejs 程序存在错误而使进程关闭了,cluster 或 forever 都能自动重启他们,以保证 nodejs 应用零宕机。html

Github 地址

https://github.com/nodejitsu/foreverjava

https://github.com/LearnBoost/clusternode


 

Geddy

Geddy

Geddy 是一个用于 NodeJS 的 web 开发框架,遵循 MVC,其目标是易用、模块化和高性能。mysql

主要功能

 

  • 强大、灵活的路由功能
  • 简单易用,基于资源(resource-based)的路由
  • 附有 app 和 resource 生成器
  • 内容协商(Content-negotiation)
  • session 支持
  • 模板(EJS)、局部视图(partial)支持
  • 彻底的非阻塞

 

有兴趣的能够去看一下它的详细介绍,一回以为 geddy 是一款很是不错的 web 开发框架,除了 express 开发者又多了一种选择。linux

Github 地址

https://github.com/mde/geddygit


node-dev

node-dev

node-dev 模块是一个开发工具,当你的 js 文件修改保存后,他会自动重启服务进程,嫌 CTRL + C / up / down 费劲的同窗能够尝试用它减轻开发调试的烦恼。github

另外它还支持桌面提醒web

使用方法

node-dev --debug app.js

Github 地址

https://github.com/fgnass/node-dev


node_redis

node_redis

是为 NodeJS 而写的 Redis client,它支持全部 redis 命令。

使用方法

 

var redis = require("redis"), client = redis.createClient(); client.on("error", function (err) { console.log("Error " + err); }); client.set("string key", "string val", redis.print); client.hset("hash key", "hashtest 1", "some value", redis.print); client.hset(["hash key", "hashtest 2", "some other value"], redis.print); client.hkeys("hash key", function (err, replies) { console.log(replies.length + " replies:"); replies.forEach(function (reply, i) { console.log(" " + i + ": " + reply); }); client.quit(); });

Github 地址

 

https://github.com/mranney/node_redis


html2jade

html2jade

html2jade 模块能够方便的转换现有的 HTML 到 Jade 格式。

目前仅支持 OS X 和 Linux 平台。

使用方法

抓取 URL 并转换源码

 

html2jade http://twitter.com // 会输出到终端控制台 html2jade http://twitter.com > twitter.jade // 输出到 twitter.jade 文件
转换现有 HTML 文件

 

 

html2jade mywebpage.html # 输出到 mywebpage.jade html2jade public/*.html # 转换全部 .html 文件到 .jade

Github 地址

 

https://github.com/donpark/html2jade


node-canvas

node-canvas

NodeJS 的 Canvas 实现,基于 Cairo。能够像浏览器端同样作图片处理:

 

var Canvas = require('../lib/canvas') , Image = Canvas.Image , fs = require('fs'); var img = new Image; img.onerror = function(err){ throw err; }; img.onload = function(){ var w = img.width / 2 , h = img.height / 2 , canvas = new Canvas(w, h) , ctx = canvas.getContext('2d'); ctx.drawImage(img, 0, 0, w, h, 0, 0, w, h); var out = fs.createWriteStream(__dirname + '/crop.jpg'); var stream = canvas.createJPEGStream({ bufsize : 2048, quality : 80 }); stream.pipe(out); }; img.src = __dirname + '/images/squid.png';

Github 地址:

 

https://github.com/LearnBoost/node-canvas


 xml2js

xml2js

xml2js 基于 sax-js模块,提供简单的 xml 到 JavaScript 对象的转换,如需解析 DOM ,jsdom更合适。

使用方法

var fs = require('fs'), xml2js = require('xml2js'); var parser = new xml2js.Parser(); fs.readFile(__dirname + '/foo.xml', function(err, data) { parser.parseString(data, function (err, result) { console.dir(result); console.log('Done'); }); });

Github 地址

https://github.com/Leonidas-from-XIV/node-xml2js


 

mailer

mailer

NodeJS 邮件发送模块,支持定制基于 Mustache 的模板正文。

使用方法

 

  var email = require("../lib/node_mailer"); for(var i = 0; i < 10; i++){ email.send({ host : "localhost", // smtp server hostname port : "25", // smtp server port ssl: true, // for SSL support - REQUIRES NODE v0.3.x OR HIGHER domain : "localhost", // domain used by client to identify itself to server to : "marak.squires@gmail.com", from : "obama@whitehouse.gov", subject : "node_mailer test email", body: "Hello! This is a test of the node_mailer.", authentication : "login", // auth login is supported; anything else is no auth username : "my_username", // username password : "my_password" // password }, function(err, result){ if(err){ console.log(err); } }); }

Github 地址

 

https://github.com/Marak/node_mailer


 

Nide

Nide

Nide是一个基于Web的开源的Node.js IDE,在MIT License下开源,代码托管于GitHub。其设计思想是简单、易用。Nide最初是在一个叫作Node Knockout的48小时编程竞赛中开发产生的。

 

http://coreh.github.com/nide/


Nide当前具备的一些功能/特性:

  • 项目树显示。
  • 文件操做(建立/删除/重命名文件及文件夹,隐藏/显示隐藏文件)。
  • 代码编辑语法高亮功能。
  • OS X Lion风格的自动保存功能。
  • OS X Lion风格的版本管理,具备恢复及同时进行多个编辑操做功能。
  • 即时的项目树过滤(使用正则表达式)。
  • 集成NPM(可显示当前已安装包,添加/移除包)。
  • 相似TextMate的漂亮的界面。
  • 可浏览Node.js文档。

jsdom

jsdom

W3C DOM 的 javascript 实现。

Github 地址:

http://github.com/tmpvar/jsdom/issues


 

Dox

Dox

兼容 Markdown, JSDoc 格式的文档生成器。

Github 地址:

https://github.com/visionmedia/dox


 

Jade

Jade

Jade 模板引擎,是 express 默认的模板引擎。

Github 地址:

https://github.com/visionmedia/jade


 

socket.io

socket.io

适合构建跨浏览器的实时应用,提供相似 WebSockets 的API。

官方网址:

http://socket.io/


 

uglify-js

uglify-js

Javascript 解析和压缩、格式化工具。

查看 CSSer 早期的翻译:

http://www.csser.com/board/4f3f516e38a5ebc978000509


npm

npm

NPM 即 Node Package Manage,是 NodeJS 模块管理工具,当前已经内置于 NodeJS 中,因此不须要特地安装了。

NPM 官方网址:

http://npmjs.org/


 

mongoosejs

mongoosejs

Mongoose 是 MongoDB 数据库的模型工具,为 NodeJS 设计,工做于异步环境下。


 

expressjs

expressjs

Express 是基于Node.js,高性能、一流的 web 开发框架。

Express JS 中文入门指引手册地址:

http://www.csser.com/tools/express-js/express-guide-reference-zh-CN.html

相关文章
相关标签/搜索