Express middleware中间件
The Express middleware modules listed here are maintained by the Expressjs team.此处列出的Express中间件模块由Expressjs团队维护。
Middleware module中间件模块 |
Description描述 |
Replaces built-in function (Express 3)替换内置功能(Express 3) |
body-parser |
Parse HTTP request body. 解析HTTP请求体。See also: body, co-body, and raw-body.另请参见:body、co-body和raw-body。 |
express.bodyParser |
compression |
Compress HTTP responses.压缩HTTP响应。 |
express.compress |
connect-rid |
Generate unique request ID.生成唯一的请求ID。 |
NA |
cookie-parser |
Parse cookie header and populate req.cookies . 解析cookie头并填充req.cookies 。See also cookies and keygrip.另请参见cookies和keygrip。 |
express.cookieParser |
cookie-session |
Establish cookie-based sessions.建立基于cookie的会话。 |
express.cookieSession |
cors |
Enable cross-origin resource sharing (CORS) with various options.使用各种选项启用跨源资源共享(CORS)。 |
NA |
csurf |
Protect from CSRF exploits.防止CSRF攻击。 |
express.csrf |
errorhandler |
Development error-handling/debugging.开发错误处理/调试。 |
express.errorHandler |
method-override |
Override HTTP methods using header.使用标头重写HTTP方法。 |
express.methodOverride |
morgan |
HTTP request logger.HTTP请求记录器。 |
express.logger |
multer |
Handle multi-part form data.处理多部分表单数据。 |
express.bodyParser |
response-time |
Record HTTP response time.记录HTTP响应时间。 |
express.responseTime |
serve-favicon |
Serve a favicon.提供网站图标。 |
express.favicon |
serve-index |
Serve directory listing for a given path.为给定路径提供目录列表。 |
express.directory |
serve-static |
Serve static files.提供静态文件。 |
express.static |
session |
Establish server-based sessions (development only).建立基于服务器的会话(仅限开发)。 |
express.session |
timeout |
Set a timeout period for HTTP request processing.设置HTTP请求处理的超时时间。 |
express.timeout |
vhost |
Create virtual domains.创建虚拟域。 |
express.vhost |
express-ws |
WebSocket endpoints for express applications用于express应用程序的WebSocket端点 |
express.vhost |
Additional middleware modules附加中间件模块
These are some additional popular middleware modules.这些是一些额外的流行中间件模块。
Warning:
This information refers to third-party sites, products, or modules that are not maintained by the Expressjs team. 此信息指的是并非由Expressjs团队维护的第三方站点、产品或模块。Listing here does not constitute an endorsement or recommendation from the Expressjs project team.此处列出的内容并不构成Expressjs项目团队的认可或建议。
Middleware module中间件 |
Description描述 |
express-jwt | Express-JWT: connect/express中间件,用于验证JsonWebToken(JWT)并使用属性设置req.auth |
jsonwebtoken |
JsonWebToken implementation for node.jsnode.js的JsonWebToken实现 |
express-unless | 当满足条件时,有条件地跳过中间件。 |
http-errors | Create HTTP errors for Express, Koa, Connect, etc. with ease.轻松地创建Express、Koa、Connect等的HTTP错误。 |
express-validator | An express.js middleware for validator.jsvalidator.js的一个express.js中间件 |
cls-rtracer |
Middleware for CLS-based request id generation. 用于基于CLS的请求id生成的中间件。An out-of-the-box solution for adding request ids into your logs.将请求ID添加到日志中的现成解决方案。 |
connect-image-optimus |
Optimize image serving. Switches images to .webp or .jxr , if possible.优化图像服务。如果可能,将图像切换到.webp 或.jxr 。 |
express-debug |
Development tool that adds information about template variables (locals), current session, and so on.添加有关模板变量(局部变量)、当前会话等信息的开发工具。 |
express-partial-response |
Filters out parts of JSON responses based on the fields query-string; by using Google API’s Partial Response.根据fields 查询字符串过滤出JSON响应的一部分;通过使用谷歌API的部分响应。 |
express-simple-cdn |
Use a CDN for static assets, with multiple host support.对静态资产使用CDN,并支持多个主机。 |
express-slash |
Handles routes with and without trailing slashes.处理带有或不带有尾部斜杠的管线。 |
express-stormpath |
User storage, authentication, authorization, SSO, and data security.用户存储、身份验证、授权、SSO和数据安全。 |
express-uncapitalize |
Redirects HTTP requests containing uppercase to a canonical lowercase form.将包含大写的HTTP请求重定向为规范的小写形式。 |
helmet |
Helps secure your apps by setting various HTTP headers.通过设置各种HTTP头帮助保护您的应用。 |
join-io |
Joins files on the fly to reduce the requests count.动态连接文件以减少请求计数。 |
passport |
Authentication using “strategies” such as OAuth, OpenID and many others. 使用OAuth、OpenID等“策略”进行身份验证。See http://passportjs.org/ for more information.看见http://passportjs.org/ 了解更多信息。 |
static-expiry |
Fingerprint URLs or caching headers for static assets.静态资产的指纹URL或缓存头。 |
view-helpers |
Common helper methods for views.视图的常用辅助方法。 |
sriracha-admin |
Dynamically generate an admin site for Mongoose.为Mongoose动态生成管理站点。 |
helmet.js |
Helmet通过设置HTTP响应标头来帮助保护Express应用程序的安全。 |
For more middleware modules, see http-framework.有关更多中间件模块,请参阅http框架。