Connect
Connect is a middleware framework for node,
shipping with over 18 bundled middleware and a rich selection of
3rd-party middleware.
var app = connect()
.use(connect.logger('dev'))
.use(connect.static('public'))
.use(function(req, res){
res.end('hello world\n');
})
.listen(3000);
Installation
$ npm install connect
Middleware
- logger request logger with custom format support
- csrf Cross-site request forgery protection
- compress Gzip compression middleware
- basicAuth basic http authentication
- bodyParser extensible request body parser
- json application/json parser
- urlencoded application/x-www-form-urlencoded parser
- multipart multipart/form-data parser
- cookieParser cookie parser
- session session management support with bundled MemoryStore
- cookieSession cookie-based session support
- methodOverride faux HTTP method support
- responseTime calculates response-time and exposes via X-Response-Time
- staticCache memory cache layer for the static() middleware
-
static streaming static file server supporting
Range
and more - directory directory listing middleware
- vhost virtual host sub-domain mapping middleware
- favicon efficient favicon server (with default icon)
- limit limit the bytesize of request bodies
-
query automatic querystring parser, populating
req.query
- errorHandler flexible error handler
Internals
- server prototype
- connect utilities
- node monkey patches
Links
- list of 3rd-party middleware
- GitHub repository
- test documentation
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)