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

相關文章
相關標籤/搜索