Skip to content

Commit

Permalink
remove body parser and various cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanong committed Jan 6, 2014
1 parent c8801e6 commit 5c5e81f
Show file tree
Hide file tree
Showing 18 changed files with 9 additions and 785 deletions.
22 changes: 1 addition & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,19 @@

TESTS = test/*.js
REPORTER = dot
DOX = ./node_modules/.bin/dox

SRC = $(shell find lib/*.js lib/middleware/*.js)
HTML = $(SRC:.js=.html)

test:
@NODE_ENV=test ./node_modules/.bin/mocha \
--reporter $(REPORTER) \
$(TESTS)

docs: $(HTML)
@mv $(HTML) docs

test-cov: lib-cov
@CONNECT_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html

lib-cov:
@jscoverage lib $@

%.html: %.js
$(DOX) < $< | node support/docs > $@

docclean:
rm -f $(HTML)

site: docclean docs
rm -fr /tmp/docs \
&& cp -fr docs /tmp/docs \
&& git checkout gh-pages \
&& cp -fr /tmp/docs/* . \
&& echo "done"

benchmark:
@./support/bench

.PHONY: test-cov site docs test docclean benchmark
.PHONY: test-cov test benchmark
4 changes: 4 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ If you would like to help maintain these middleware, please contact [@jongleberr

These middleware are officially supported by the Connect/Express team:

- [body-parser](https://github.com/expressjs/body-parser) - previous `bodyParser`, `json`, and `urlencoded`. You may also be interested in:
- [body](https://github.com/raynos/body)
- [co-body](https://github.com/visionmedia/co-body)
- [raw-body](https://github.com/stream-utils/raw-body)
- [compression](https://github.com/expressjs/compression) - previously `compress`

These middleware previously included with Connect are no longer supported by the Connect/Express team. Use one of these alternatives intead:
Expand Down
12 changes: 0 additions & 12 deletions lib/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,6 @@ require('./patch');

exports = module.exports = createServer;

/**
* Framework version.
*/

exports.version = '2.7.11';

/**
* Expose mime module.
*/

exports.mime = require('./middleware/static').mime;

/**
* Expose the prototype.
*/
Expand Down
63 changes: 0 additions & 63 deletions lib/middleware/bodyParser.js

This file was deleted.

87 changes: 0 additions & 87 deletions lib/middleware/json.js

This file was deleted.

9 changes: 0 additions & 9 deletions lib/middleware/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,3 @@ exports = module.exports = function(root, options){
.pipe(res);
};
};

/**
* Expose mime module.
*
* If you wish to extend the mime table use this
* reference to the "mime" module in the npm registry.
*/

exports.mime = send.mime;
76 changes: 0 additions & 76 deletions lib/middleware/urlencoded.js

This file was deleted.

29 changes: 0 additions & 29 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,6 @@ var http = require('http')
, sep = require('path').sep
, signature = require('cookie-signature');

/**
* Return `true` if the request has a body, otherwise return `false`.
*
* @param {IncomingMessage} req
* @return {Boolean}
* @api private
*/

exports.hasBody = function(req) {
var encoding = 'transfer-encoding' in req.headers;
var length = 'content-length' in req.headers && req.headers['content-length'] !== '0';
return encoding || length;
};

/**
* Extract the mime type from the given request's
* _Content-Type_ header.
*
* @param {IncomingMessage} req
* @return {String}
* @api private
*/

exports.mime = function(req) {
var str = req.headers['content-type'] || ''
, i = str.indexOf(';');
return ~i ? str.slice(0, i) : str;
};

/**
* Generate an `Error` from the given status `code`
* and optional `msg`.
Expand Down
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@
"uid2": "0.0.3",
"debug": ">= 0.7.3 < 1",
"methods": "0.1.0",
"raw-body": "1.1.2",
"negotiator": "0.3.0"
},
"devDependencies": {
"should": ">= 2.0.2 < 3",
"mocha": ">= 1.13.0 < 2",
"jade": ">= 0.35.0 < 1",
"dox": ">= 0.4.4 < 1"
"mocha": ">= 1.13.0 < 2"
},
"licenses": [
{
Expand All @@ -40,7 +37,7 @@
],
"main": "index",
"engines": {
"node": ">= 0.8.0"
"node": ">= 0.10.0"
},
"scripts": {
"test": "make"
Expand Down
Loading

0 comments on commit 5c5e81f

Please sign in to comment.