Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

connect

Package Overview
Dependencies
Maintainers
4
Versions
234
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect - npm Package Compare versions

Comparing version 3.3.0 to 3.3.1

24

History.md

@@ -0,1 +1,7 @@

3.3.1 / 2014-10-22
==================
* deps: finalhandler@0.3.2
- deps: on-finished@~2.1.1
3.3.0 / 2014-10-17

@@ -77,2 +83,20 @@ ==================

2.27.1 / 2014-10-22
===================
* deps: body-parser@~1.9.1
- deps: on-finished@~2.1.1
- deps: qs@2.3.0
- deps: type-is@~1.5.2
* deps: express-session@~1.9.1
- Remove unnecessary empty write call
* deps: finalhandler@0.3.2
- deps: on-finished@~2.1.1
* deps: morgan@~1.4.1
- deps: on-finished@~2.1.1
* deps: qs@2.3.0
- Fix parsing of mixed implicit and explicit arrays
* deps: serve-static@~1.7.1
- deps: send@0.10.1
2.27.0 / 2014-10-16

@@ -79,0 +103,0 @@ ===================

8

package.json
{
"name": "connect",
"description": "High performance middleware framework",
"version": "3.3.0",
"version": "3.3.1",
"author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)",

@@ -21,3 +21,3 @@ "contributors": [

"debug": "~2.1.0",
"finalhandler": "0.3.1",
"finalhandler": "0.3.2",
"parseurl": "~1.3.0",

@@ -28,4 +28,4 @@ "utils-merge": "1.0.0"

"istanbul": "0.3.2",
"mocha": "~1.21.4",
"should": "~4.0.0",
"mocha": "~2.0.0",
"should": "~4.1.0",
"supertest": "~0.14.0"

@@ -32,0 +32,0 @@ },

@@ -40,13 +40,82 @@ # Connect

## Connect 3.0
## Getting Started
Connect 3.0 is in progress in the `master` branch. The main changes in Connect are:
Connect is a simple framework to glue together various "middleware" to handle requests.
- Middleware will be moved to their own repositories in the [expressjs](http://github.com/expressjs) organization
- All node patches will be removed - all middleware _should_ work without Connect and with similar frameworks like [restify](https://github.com/mcavage/node-restify)
- Node `0.8` is no longer supported
- The website documentation has been removed - view the markdown readmes instead
### Install Connect
If you would like to help maintain these middleware, please contact a [member of the expressjs team](https://github.com/orgs/expressjs/people).
```sh
$ npm install connect
```
### Create an app
The main component is a Connect "app". This will store all the middleware
added and is, itself, a function.
```js
var app = connect();
```
### Use middleware
The core of Connect is "using" middleware. Middleware are added as a "stack"
where incoming requests will execure each middleware one-by-one until a middleware
does not call `next()` within it.
```js
app.use(function middleware1(req, res, next) {
// middleware 1
next();
});
app.use(function middleware2(req, res, next) {
// middleware 2
next();
});
```
### Mount middleware
The `.use()` method also takes an optional path string that is matched against
the beginning of the incoming request URL. This allows for basic routing.
```js
app.use('/foo', function fooMiddleware(req, res, next) {
// req.url starts with "/foo"
next();
});
app.use('/bar', function barMiddleware(req, res, next) {
// req.url starts with "/bar"
next();
});
```
### Error middleware
There are special cases of "error-handling" middleware. There are middleware
where the function takes exactly 4 arguments. Errors that occur in the middleware
added before the error middleware will invoke this middleware when errors occur.
```js
app.use(function onerror(err, req, res, next) {
// an error occurred!
});
```
### Create a server from the app
The last step is to actually use the Connect app in a server. The `.listen()` method
is a convenience to start a HTTP server.
```js
var server = app.listen(port);
```
The app itself is really just a function with three arguments, so it can also be handed
to `.createServer()` in Node.js.
```js
var server = http.createServer(app);
```
## Middleware

@@ -53,0 +122,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc