1 | # Connect
|
2 |
|
3 | [![NPM Version][npm-image]][npm-url]
|
4 | [![NPM Downloads][downloads-image]][downloads-url]
|
5 | [![Build Status][travis-image]][travis-url]
|
6 | [![Test Coverage][coveralls-image]][coveralls-url]
|
7 | [![Gratipay][gratipay-image]][gratipay-url]
|
8 |
|
9 | Connect is an extensible HTTP server framework for [node](http://nodejs.org), providing high performance "plugins" known as _middleware_.
|
10 |
|
11 | Connect is bundled with over _20_ commonly used middleware, including
|
12 | a logger, session support, cookie parser, and [more](http://senchalabs.github.com/connect). Be sure to view the 2.x [documentation](http://www.senchalabs.org/connect/).
|
13 |
|
14 | ```js
|
15 | var connect = require('connect')
|
16 | , http = require('http');
|
17 |
|
18 | var app = connect()
|
19 | .use(connect.favicon('public/favicon.ico'))
|
20 | .use(connect.logger('dev'))
|
21 | .use(connect.static('public'))
|
22 | .use(connect.directory('public'))
|
23 | .use(connect.cookieParser())
|
24 | .use(connect.session({ secret: 'my secret here' }))
|
25 | .use(function(req, res){
|
26 | res.end('Hello from Connect!\n');
|
27 | });
|
28 |
|
29 | http.createServer(app).listen(3000);
|
30 | ```
|
31 |
|
32 | ## Middleware
|
33 |
|
34 | - [basicAuth](http://www.senchalabs.org/connect/basicAuth.html)
|
35 | - [bodyParser](http://www.senchalabs.org/connect/bodyParser.html)
|
36 | - [compress](http://www.senchalabs.org/connect/compress.html)
|
37 | - [cookieParser](http://www.senchalabs.org/connect/cookieParser.html)
|
38 | - [cookieSession](http://www.senchalabs.org/connect/cookieSession.html)
|
39 | - [csrf](http://www.senchalabs.org/connect/csrf.html)
|
40 | - [directory](http://www.senchalabs.org/connect/directory.html)
|
41 | - [errorHandler](http://www.senchalabs.org/connect/errorHandler.html)
|
42 | - [favicon](http://www.senchalabs.org/connect/favicon.html)
|
43 | - [json](http://www.senchalabs.org/connect/json.html)
|
44 | - [limit](http://www.senchalabs.org/connect/limit.html) - deprecated, do not use
|
45 | - [logger](http://www.senchalabs.org/connect/logger.html)
|
46 | - [methodOverride](http://www.senchalabs.org/connect/methodOverride.html) - deprecated, use [method-override](https://www.npmjs.org/package/method-override) instead
|
47 | - [multipart](http://www.senchalabs.org/connect/multipart.html) - deprecated, use [connect-multiparty](https://www.npmjs.org/package/connect-multiparty) instead
|
48 | - [urlencoded](http://www.senchalabs.org/connect/urlencoded.html)
|
49 | - [query](http://www.senchalabs.org/connect/query.html)
|
50 | - [responseTime](http://www.senchalabs.org/connect/responseTime.html)
|
51 | - [session](http://www.senchalabs.org/connect/session.html)
|
52 | - [static](http://www.senchalabs.org/connect/static.html)
|
53 | - [staticCache](http://www.senchalabs.org/connect/staticCache.html) - deprecated, do not use
|
54 | - [subdomains](http://www.senchalabs.org/connect/subdomains.html)
|
55 | - [vhost](http://www.senchalabs.org/connect/vhost.html)
|
56 |
|
57 | ## Running Tests
|
58 |
|
59 | first:
|
60 |
|
61 | $ npm install -d
|
62 |
|
63 | then:
|
64 |
|
65 | $ npm test
|
66 |
|
67 | ## Contributors
|
68 |
|
69 | https://github.com/senchalabs/connect/graphs/contributors
|
70 |
|
71 | ## Node Compatibility
|
72 |
|
73 | Connect `< 1.x` is compatible with node 0.2.x
|
74 |
|
75 |
|
76 | Connect `1.x` is compatible with node 0.4.x
|
77 |
|
78 |
|
79 | Connect `2.x` is compatible with node 0.8.x, 0.10.x, and 0.12.x
|
80 |
|
81 | ## License
|
82 |
|
83 | [MIT](LICENSE)
|
84 |
|
85 | [npm-image]: https://img.shields.io/npm/v/connect.svg
|
86 | [npm-url]: https://npmjs.org/package/connect
|
87 | [travis-image]: https://img.shields.io/travis/senchalabs/connect/master.svg
|
88 | [travis-url]: https://travis-ci.org/senchalabs/connect
|
89 | [coveralls-image]: https://img.shields.io/coveralls/senchalabs/connect/master.svg
|
90 | [coveralls-url]: https://coveralls.io/r/senchalabs/connect
|
91 | [downloads-image]: https://img.shields.io/npm/dm/connect.svg
|
92 | [downloads-url]: https://npmjs.org/package/connect
|
93 | [gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
|
94 | [gratipay-url]: https://www.gratipay.com/dougwilson/
|