Readme.md 3.67 KB
Newer Older
1 2
# Connect

3 4 5 6 7
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]
[![Gittip][gittip-image]][gittip-url]
8

Tj Holowaychuk's avatar
Tj Holowaychuk committed
9
  Connect is an extensible HTTP server framework for [node](http://nodejs.org), providing high performance "plugins" known as _middleware_.
Tj Holowaychuk's avatar
Tj Holowaychuk committed
10

TJ Holowaychuk's avatar
TJ Holowaychuk committed
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/).
Tj Holowaychuk's avatar
Tj Holowaychuk committed
13

14 15 16 17 18
```js
var connect = require('connect')
  , http = require('http');

var app = connect()
19
  .use(connect.favicon('public/favicon.ico'))
20 21 22
  .use(connect.logger('dev'))
  .use(connect.static('public'))
  .use(connect.directory('public'))
23 24
  .use(connect.cookieParser())
  .use(connect.session({ secret: 'my secret here' }))
25 26 27 28 29 30 31
  .use(function(req, res){
    res.end('Hello from Connect!\n');
  });

http.createServer(app).listen(3000);
```

32 33
## Middleware

34 35
  - [basicAuth](http://www.senchalabs.org/connect/basicAuth.html)
  - [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 39
  - [cookieSession](http://www.senchalabs.org/connect/cookieSession.html)
  - [csrf](http://www.senchalabs.org/connect/csrf.html)
40 41 42
  - [directory](http://www.senchalabs.org/connect/directory.html)
  - [errorHandler](http://www.senchalabs.org/connect/errorHandler.html)
  - [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 47
  - [methodOverride](http://www.senchalabs.org/connect/methodOverride.html) - deprecated, use [method-override](https://www.npmjs.org/package/method-override) instead
  - [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 50 51 52
  - [query](http://www.senchalabs.org/connect/query.html)
  - [responseTime](http://www.senchalabs.org/connect/responseTime.html)
  - [session](http://www.senchalabs.org/connect/session.html)
  - [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

Tj Holowaychuk's avatar
Tj Holowaychuk committed
57 58 59 60
## Running Tests

first:

Tj Holowaychuk's avatar
Tj Holowaychuk committed
61
    $ npm install -d
Tj Holowaychuk's avatar
Tj Holowaychuk committed
62 63 64

then:

65
    $ npm test
Tj Holowaychuk's avatar
Tj Holowaychuk committed
66

67 68 69
## Contributors

 https://github.com/senchalabs/connect/graphs/contributors
Tj Holowaychuk's avatar
Tj Holowaychuk committed
70

Tj Holowaychuk's avatar
Tj Holowaychuk committed
71 72
## Node Compatibility

Tj Holowaychuk's avatar
Tj Holowaychuk committed
73
  Connect `< 1.x` is compatible with node 0.2.x
Tj Holowaychuk's avatar
Tj Holowaychuk committed
74 75


Tj Holowaychuk's avatar
Tj Holowaychuk committed
76 77 78
  Connect `1.x` is compatible with node 0.4.x


79
  Connect `2.x` is compatible with node 0.8.x
80 81


82
  Connect `3.x` is compatible with node 0.10.x
Tj Holowaychuk's avatar
Tj Holowaychuk committed
83

Tj Holowaychuk's avatar
Tj Holowaychuk committed
84 85
## License

86
[MIT](LICENSE)
87 88 89 90 91 92 93

[npm-image]: https://img.shields.io/npm/v/connect.svg?style=flat
[npm-url]: https://npmjs.org/package/connect
[travis-image]: https://img.shields.io/travis/senchalabs/connect.svg?style=flat
[travis-url]: https://travis-ci.org/senchalabs/connect
[coveralls-image]: https://img.shields.io/coveralls/senchalabs/connect.svg?style=flat
[coveralls-url]: https://coveralls.io/r/senchalabs/connect
94
[downloads-image]: https://img.shields.io/npm/dm/connect.svg?style=flat
95 96 97
[downloads-url]: https://npmjs.org/package/connect
[gittip-image]: https://img.shields.io/gittip/dougwilson.svg?style=flat
[gittip-url]: https://www.gittip.com/dougwilson/