node 项目中的模块

文章目录
  1. 1. ejs-mate
  2. 2. oneapm
  3. 3. colors
  4. 4. loader
  5. 5. express
  6. 6. express-session
  7. 7. passport
  8. 8. loadash
  9. 9. csurf
  10. 10. compression
  11. 11. body-parser
  12. 12. connect-busboy
  13. 13. errorhandler
  14. 14. helmet
  15. 15. url
  16. 16. response-time
  17. 17. method-override
  18. 18. cookie-parser

项目中使用到的一些modules的介绍

ejs-mate

模板语言

oneapm

oneapm 是个用来监控网站性能的服务,性能监控解决方案

colors

get colors in your node.js console.

两种使用方式:

扩展String.prototype

1
2
3
4
5
6
7
require('colors');

console.log('hello'.green); // outputs green text
console.log('i like cake and pies'.underline.red) // outputs red underlined text
console.log('inverse the color'.inverse); // inverses the color
console.log('OMG Rainbows!'.rainbow); // rainbow
console.log('Run the trap'.trap); // Drops the bass

不扩展String.prototype

1
2
3
4
5
6
7
var colors = require('colors/safe');

console.log(colors.green('hello')); // outputs green text
console.log(colors.red.underline('i like cake and pies')) // outputs red underlined text
console.log(colors.inverse('inverse the color')); // inverses the color
console.log(colors.rainbow('OMG Rainbows!')); // rainbow
console.log(colors.trap('Run the trap')); // Drops the bass

loader

Node静态资源加载器。该模块通过两个步骤配合完成,代码部分根据环境生成标签。上线时,需要调用minify方法进行静态资源的合并和压缩。

express

基于 Node.js 平台,快速、开放、极简的 web 开发框架。

express-session

Simple session middleware for Express

passport

兼容express的身份认证中间件

loadash

javascript 的一个工具库,类似underscore的一个东西

csurf

Node.js CSRF protection middleware. Cross-site request forgery跨站请求伪造

compression

nodejs 压缩中间件,http请求返回的资源进行压缩?

body-parser

Node.js body parsing middleware.

connect-busboy

Connect middleware for busboy

errorhandler

helmet

Helmet是一系列帮助增强Node.JS之Express/Connect等Javascript Web应用安全的中间件。

一些著名的对Web攻击有XSS跨站脚本, 脚本注入 clickjacking 以及各种非安全的请求等对Node.js的Web应用构成各种威胁,使用Helmet能帮助你的应用避免这些攻击。

url

提取url的各种信息

response-time

This module creates a middleware that records the response time for requests in HTTP servers. The “response time” is defined here as the elapsed time from when a request enters this middleware to when the headers are written out to the client.

method-override

Lets you use HTTP verbs such as PUT or DELETE in places where the client doesn’t support it.

cookie parsing with signatures