- 快速入门
- 指南
- 参考手册
- 高级主题
- 资源
- Express 词汇表
- Express 社区
- 模板引擎
- Express 中间件
- Express body-parser middleware
- Express compression middleware
- Express connect-rid middleware
- Express cookie-parser middleware
- Express cookie-session middleware
- Express cors middleware
- Express csurf middleware
- Express errorhandler middleware
- Express method-override middleware
- Express morgan middleware
- Express multer middleware
- Express response-time middleware
- Express serve-favicon middleware
- Express serve-index middleware
- Express serve-static middleware
- Express session middleware
- Express timeout middleware
- Express vhost middleware
- Express 实用模板
- 推荐框架
- 推荐书籍和博客
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
Express 中间件
Express middleware
The Express middleware modules listed here are maintained by the Expressjs team.
Middleware module | Description | Replaces built-in function (Express 3) |
---|---|---|
body-parser | Parse HTTP request body. See also: body, co-body, and raw-body. | express.bodyParser |
compression | Compress HTTP responses. | express.compress |
connect-rid | Generate unique request ID. | NA |
cookie-parser | Parse cookie header and populate req.cookies . See also cookies and keygrip. | express.cookieParser |
cookie-session | Establish cookie-based sessions. | express.cookieSession |
cors | Enable cross-origin resource sharing (CORS) with various options. | NA |
csurf | Protect from CSRF exploits. | express.csrf |
errorhandler | Development error-handling/debugging. | express.errorHandler |
method-override | Override HTTP methods using header. | express.methodOverride |
morgan | HTTP request logger. | express.logger |
multer | Handle multi-part form data. | express.bodyParser |
response-time | Record HTTP response time. | 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. | express.timeout |
vhost | Create virtual domains. | 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. Listing here does not constitute an endorsement or recommendation from the Expressjs project team.
Middleware module | Description |
---|---|
cls-rtracer | Middleware for CLS-based request id generation. An out-of-the-box solution for adding request ids into your logs. |
connect-image-optimus | Optimize image serving. Switches images to .webp or .jxr , if possible. |
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. |
express-simple-cdn | Use a CDN for static assets, with multiple host support. |
express-slash | Handles routes with and without trailing slashes. |
express-stormpath | User storage, authentication, authorization, SSO, and data security. |
express-uncapitalize | Redirects HTTP requests containing uppercase to a canonical lowercase form. |
helmet | Helps secure your apps by setting various HTTP headers. |
join-io | Joins files on the fly to reduce the requests count. |
passport | Authentication using “strategies” such as OAuth, OpenID and many others. See http://passportjs.org/ for more information. |
static-expiry | Fingerprint URLs or caching headers for static assets. |
view-helpers | Common helper methods for views. |
sriracha-admin | Dynamically generate an admin site for Mongoose. |
For more middleware modules, see http-framework.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论