Permalink
Browse files

removed "root" setting

screw it, no one will understand anyway
  • Loading branch information...
tj committed Nov 24, 2011
1 parent 5d593f2 commit 87b991c076e79a520722778127680b3fce0f1fa9
Showing with 22 additions and 40 deletions.
  1. +1 −7 lib/application.js
  2. +4 −6 lib/response.js
  3. +0 −1 test/app.locals.js
  4. +0 −9 test/app.use.js
  5. +17 −17 test/res.clearCookie.js
View
@@ -79,7 +79,6 @@ app.defaultConfiguration = function(){
var self = this;
// default settings
- this.set('root', '/');
this.set('env', process.env.NODE_ENV || 'development');
// implicit middleware
@@ -191,13 +190,8 @@ app.use = function(route, fn){
connect.proto.use.call(this, route, fn);
- // mounted an app, emit "mount"
- // and adjust some settings
+ // mounted an app
if (app) {
- var root = this.get('root') || this.route;
- if ('/' == root) root = '';
- root = root + (app.get('root') || app.route);
- app.set('root', root);
app.parent = this;
app.emit('mount', this);
}
View
@@ -362,7 +362,7 @@ res.header = function(field, val){
*/
res.clearCookie = function(name, options){
- var opts = { expires: new Date(1), path: this.app.get('root') };
+ var opts = { expires: new Date(1), path: '/' };
return this.cookie(name, '', options
? utils.merge(opts, options)
: opts);
@@ -392,7 +392,7 @@ res.signedCookie = function(name, val, options){
* Options:
*
* - `maxAge` max-age in milliseconds, converted to `expires`
- * - `path` defaults to the "root" setting which is typically "/"
+ * - `path` defaults to "/"
*
* Examples:
*
@@ -412,7 +412,7 @@ res.cookie = function(name, val, options){
options = options || {};
if ('object' == typeof val) val = 'j:' + JSON.stringify(val);
if ('maxAge' in options) options.expires = new Date(Date.now() + options.maxAge);
- if (undefined === options.path) options.path = this.app.set('root');
+ if (undefined === options.path) options.path = '/';
var cookie = utils.serializeCookie(name, val, options);
this.header('Set-Cookie', cookie);
return this;
@@ -424,9 +424,7 @@ res.cookie = function(name, val, options){
*
* The given `url` can also be the name of a mapped url, for
* example by default express supports "back" which redirects
- * to the _Referrer_ or _Referer_ headers or the application's
- * "root" setting. Express also supports "root" out of the box,
- * which can be set via `app.set('root', '/blog');`.
+ * to the _Referrer_ or _Referer_ headers or "/".
*
* Examples:
*
View
@@ -20,7 +20,6 @@ describe('app', function(){
var app = express();
app.set('title', 'House of Manny');
var obj = app.locals.settings;
- obj.should.have.property('root', '/');
obj.should.have.property('env', 'test');
obj.should.have.property('title', 'House of Manny');
})
View
@@ -63,14 +63,5 @@ describe('app', function(){
app.use('/blog', blog);
blog.parent.should.equal(app);
})
-
- // it('should set "root" to the mount-point', function(){
- // var blog = express()
- // , app = express();
- //
- // app.use('/blog', blog);
- // blog.get('root').should.equal('/blog');
- // })
})
})
-
View
@@ -20,23 +20,23 @@ describe('res', function(){
})
})
- it('should default path to "root"', function(done){
- var app = express();
-
- app.set('root', '/admin');
-
- app.use(function(req, res){
- res.clearCookie('sid').end();
- });
-
- request(app)
- .get('/')
- .end(function(res){
- var val = 'sid=; path=/admin; expires=Thu, 01 Jan 1970 00:00:00 GMT';
- res.headers['set-cookie'].should.eql([val]);
- done();
- })
- })
+ // it('should default path to "root"', function(done){
+ // var app = express();
+ //
+ // app.set('root', '/admin');
+ //
+ // app.use(function(req, res){
+ // res.clearCookie('sid').end();
+ // });
+ //
+ // request(app)
+ // .get('/')
+ // .end(function(res){
+ // var val = 'sid=; path=/admin; expires=Thu, 01 Jan 1970 00:00:00 GMT';
+ // res.headers['set-cookie'].should.eql([val]);
+ // done();
+ // })
+ // })
})
describe('.clearCookie(name, options)', function(){

3 comments on commit 87b991c

@slaskis

This comment has been minimized.

Show comment Hide comment
@slaskis

slaskis Nov 28, 2011

Contributor

Does this mean that redirects won't be based on the app inheritance anymore and that they're always an absolute path?

Contributor

slaskis replied Nov 28, 2011

Does this mean that redirects won't be based on the app inheritance anymore and that they're always an absolute path?

@tj

This comment has been minimized.

Show comment Hide comment
@tj

tj Nov 28, 2011

Owner

just going to do it a different way, the combination of "root" and app.route from .use() was getting too stupid

Owner

tj replied Nov 28, 2011

just going to do it a different way, the combination of "root" and app.route from .use() was getting too stupid

@slaskis

This comment has been minimized.

Show comment Hide comment
@slaskis

slaskis Nov 28, 2011

Contributor

yeah, I guess a while(app.parent)-loop (or something more efficient) could do the trick too

Contributor

slaskis replied Nov 28, 2011

yeah, I guess a while(app.parent)-loop (or something more efficient) could do the trick too

Please sign in to comment.