Comparing version 3.1.0 to 3.1.1
3.1.1 / 2013-04-01 | ||
================== | ||
* add X-Forwarded-Host support to `req.host` | ||
* fix relative redirects | ||
* update mkdirp | ||
* update buffer-crc32 | ||
* remove legacy app.configure() method from app template. | ||
3.1.0 / 2013-01-25 | ||
@@ -3,0 +12,0 @@ ================== |
@@ -37,3 +37,2 @@ /** | ||
this.engines = {}; | ||
this.viewCallbacks = []; | ||
this.defaultConfiguration(); | ||
@@ -165,3 +164,3 @@ }; | ||
* engines to follow this convention, thus allowing them to | ||
* work seeessly within Express. | ||
* work seamlessly within Express. | ||
* | ||
@@ -410,3 +409,3 @@ * @param {String} ext | ||
// if no router attacked yet, attach the router | ||
// if no router attached yet, attach the router | ||
if (!this._usedRouter) this.use(this.router); | ||
@@ -413,0 +412,0 @@ |
@@ -23,3 +23,3 @@ /** | ||
exports.version = '3.1.0'; | ||
exports.version = '3.1.1'; | ||
@@ -26,0 +26,0 @@ /** |
@@ -443,3 +443,6 @@ | ||
req.__defineGetter__('host', function(){ | ||
return this.get('Host').split(':')[0]; | ||
var trustProxy = this.app.get('trust proxy'); | ||
var host = trustProxy && this.get('X-Forwarded-Host'); | ||
host = host || this.get('Host'); | ||
return host.split(':')[0]; | ||
}); | ||
@@ -446,0 +449,0 @@ |
@@ -637,9 +637,11 @@ /** | ||
if (!~url.indexOf('://') && 0 != url.indexOf('//')) { | ||
var path = app.path(); | ||
var path | ||
// relative to path | ||
if ('.' == url[0]) { | ||
url = req.path + '/' + url; | ||
// relative to mount-point | ||
path = req.originalUrl.split('?')[0] | ||
url = path + ('/' == path[path.length - 1] ? '' : '/') + url; | ||
// relative to mount-point | ||
} else if ('/' != url[0]) { | ||
path = app.path(); | ||
url = path + '/' + url; | ||
@@ -646,0 +648,0 @@ } |
@@ -23,5 +23,5 @@ | ||
* Make `locals()` bound to the given `obj`. | ||
* | ||
* This is used for `app.locals` and `res.locals`. | ||
* | ||
* This is used for `app.locals` and `res.locals`. | ||
* | ||
* @param {Object} obj | ||
@@ -33,4 +33,2 @@ * @return {Function} | ||
exports.locals = function(obj){ | ||
obj.viewCallbacks = obj.viewCallbacks || []; | ||
function locals(obj){ | ||
@@ -284,2 +282,2 @@ for (var key in obj) locals[key] = obj[key]; | ||
return new RegExp('^' + path + '$', sensitive ? '' : 'i'); | ||
} | ||
} |
@@ -11,3 +11,3 @@ /** | ||
, extname = path.extname | ||
, exists = fs.existsSync || path.existsSync | ||
, exists = fs.existsSync || path.existsSync | ||
, join = path.join; | ||
@@ -26,5 +26,5 @@ | ||
* | ||
* - `defaultEngine` the default template engine name | ||
* - `engines` template engine require() cache | ||
* - `root` root path for view lookup | ||
* - `defaultEngine` the default template engine name | ||
* - `engines` template engine require() cache | ||
* - `root` root path for view lookup | ||
* | ||
@@ -31,0 +31,0 @@ * @param {String} name |
{ | ||
"name": "express", | ||
"description": "Sinatra inspired web development framework", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
"contributors": [ | ||
{ "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" }, | ||
{ "name": "Aaron Heckmann", "email": "aaron.heckmann+github@gmail.com" }, | ||
{ "name": "Ciaran Jessup", "email": "ciaranj@gmail.com" }, | ||
{ "name": "Guillermo Rauch", "email": "rauchg@gmail.com" } | ||
{ | ||
"name": "TJ Holowaychuk", | ||
"email": "tj@vision-media.ca" | ||
}, | ||
{ | ||
"name": "Aaron Heckmann", | ||
"email": "aaron.heckmann+github@gmail.com" | ||
}, | ||
{ | ||
"name": "Ciaran Jessup", | ||
"email": "ciaranj@gmail.com" | ||
}, | ||
{ | ||
"name": "Guillermo Rauch", | ||
"email": "rauchg@gmail.com" | ||
} | ||
], | ||
"dependencies": { | ||
"connect": "2.7.2", | ||
"connect": "2.7.4", | ||
"commander": "0.6.1", | ||
"range-parser": "0.0.4", | ||
"mkdirp": "0.3.3", | ||
"mkdirp": "~0.3.4", | ||
"cookie": "0.0.5", | ||
"buffer-crc32": "0.1.1", | ||
"buffer-crc32": "~0.2.1", | ||
"fresh": "0.1.0", | ||
@@ -49,9 +61,12 @@ "methods": "0.0.1", | ||
"main": "index", | ||
"bin": { "express": "./bin/express" }, | ||
"bin": { | ||
"express": "./bin/express" | ||
}, | ||
"scripts": { | ||
"prepublish" : "npm prune", | ||
"prepublish": "npm prune", | ||
"test": "make test" | ||
}, | ||
"engines": { "node": "*" } | ||
"engines": { | ||
"node": "*" | ||
} | ||
} | ||
![express logo](http://f.cl.ly/items/0V2S1n0K1i3y1c122g04/Screen%20Shot%202012-04-11%20at%209.59.42%20AM.png) | ||
Fast, unopinionated, minimalist web framework for [node](http://nodejs.org). [![Build Status](https://secure.travis-ci.org/visionmedia/express.png)](http://travis-ci.org/visionmedia/express) | ||
Fast, unopinionated, minimalist web framework for [node](http://nodejs.org). [![Build Status](https://secure.travis-ci.org/visionmedia/express.png)](http://travis-ci.org/visionmedia/express) [![Dependency Status](https://gemnasium.com/visionmedia/express.png)](https://gemnasium.com/visionmedia/express) | ||
@@ -54,3 +54,3 @@ ```js | ||
HTTP APIs. | ||
Built on Connect you can use _only_ what you need, and nothing more, applications | ||
@@ -70,2 +70,3 @@ can be as big or as small as you like, even a single file. Express does | ||
* [Русскоязычная документация](http://express-js.ru/) | ||
* Run express examples [online](https://runnable.com/express) | ||
@@ -101,3 +102,3 @@ ## Viewing Examples | ||
files : 237 | ||
authors: | ||
authors: | ||
1891 Tj Holowaychuk 53.1% | ||
@@ -159,3 +160,3 @@ 1285 visionmedia 36.1% | ||
## License | ||
## License | ||
@@ -162,0 +163,0 @@ (The MIT License) |
32
test.js
@@ -9,7 +9,31 @@ | ||
app.get('/', function(req, res){ | ||
console.log(req.query); | ||
var users = ['foo', 'bar', 'baz']; | ||
app.use(express.bodyParser()); | ||
app.get('/api/users', function(req, res){ | ||
res.send(users); | ||
}); | ||
app.listen(3000); | ||
console.log('listening on 3000'); | ||
app.del('/api/users', function(req, res){ | ||
users = []; | ||
res.send(200); | ||
}); | ||
app.post('/api/users', function(req, res){ | ||
users.push(req.body.name); | ||
res.send(201); | ||
}); | ||
app.get('/api/user/:id', function(req, res){ | ||
var id = req.params.id; | ||
res.send(users[id]); | ||
}); | ||
app.use('/api', function(req, res, next){ | ||
var err = new Error('Method Not Allowed'); | ||
err.status = 405; | ||
}); | ||
app.listen(5555); | ||
console.log('listening on 5555'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
116468
2333
181
+ Addedbuffer-crc32@0.2.13(transitive)
+ Addedbytes@0.2.0(transitive)
+ Addedconnect@2.7.4(transitive)
+ Addedmkdirp@0.3.5(transitive)
- Removedbytes@0.1.0(transitive)
- Removedconnect@2.7.2(transitive)
- Removedmkdirp@0.3.3(transitive)
Updatedbuffer-crc32@~0.2.1
Updatedconnect@2.7.4
Updatedmkdirp@~0.3.4