Comparar commits
33 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| e2cdd760d8 | |||
| 4169202a41 | |||
| 835982c561 | |||
| b67bacea18 | |||
| 3205ee7d75 | |||
| ff7d5ff4e5 | |||
| 723774af27 | |||
| c3fbd3fe10 | |||
| d1d3871550 | |||
| 5462c8c7ec | |||
| 9536341e30 | |||
| 1bb798d963 | |||
| 91997e9c53 | |||
| 1393187040 | |||
| 6e69c880d9 | |||
| 59dcd03972 | |||
| 11482546a2 | |||
| 1ce43dd347 | |||
| d1bfe137d4 | |||
| 9d7452cdc2 | |||
| d9cee90efc | |||
| 175aa08500 | |||
| c9ff6198d3 | |||
| f026218c82 | |||
| 5bc86b9e29 | |||
| 5830ac9936 | |||
| d7c6c9a9f9 | |||
| 9c87eed60e | |||
| f15eb6d5ef | |||
| 5b33788359 | |||
| 11ec3ccd48 | |||
| 9d498ba3f1 | |||
| 15d4047180 |
+26
-1
@@ -1,5 +1,30 @@
|
||||
|
||||
2.3.7 / 2011-05-23
|
||||
2.3.11 / 2011-06-04
|
||||
==================
|
||||
|
||||
* Added `npm test`
|
||||
* Removed generation of dummy test file from `express(1)`
|
||||
* Fixed; `express(1)` adds express as a dep
|
||||
* Fixed; prune on `prepublish`
|
||||
|
||||
2.3.10 / 2011-05-27
|
||||
==================
|
||||
|
||||
* Added `req.route`, exposing the current route
|
||||
* Added _package.json_ generation support to `express(1)`
|
||||
* Fixed call to `app.param()` function for optional params. Closes #682
|
||||
|
||||
2.3.9 / 2011-05-25
|
||||
==================
|
||||
|
||||
* Fixed bug-ish with `../' in `res.partial()` calls
|
||||
|
||||
2.3.8 / 2011-05-24
|
||||
==================
|
||||
|
||||
* Fixed `app.options()`
|
||||
|
||||
2.3.7 / 2011-05-23
|
||||
==================
|
||||
|
||||
* Added route `Collection`, ex: `app.get('/user/:id').remove();`
|
||||
|
||||
+19
@@ -20,6 +20,23 @@ or to access the `express(1)` executable install globally:
|
||||
|
||||
$ npm install -g express
|
||||
|
||||
## Quick Start
|
||||
|
||||
The quickest way to get started with express is to utilize the executable `express(1)` to generate an application as shown below:
|
||||
|
||||
Create the app:
|
||||
|
||||
$ npm install -g express
|
||||
$ express /tmp/foo && cd /tmp/foo
|
||||
|
||||
Install dependencies:
|
||||
|
||||
$ npm install -d
|
||||
|
||||
Start the server:
|
||||
|
||||
$ node app.js
|
||||
|
||||
## Features
|
||||
|
||||
* Robust routing
|
||||
@@ -62,6 +79,8 @@ The following are the major contributors of Express (in no specific order).
|
||||
* [express-configure](http://github.com/visionmedia/express-configuration) async configuration support
|
||||
* [express-messages](http://github.com/visionmedia/express-messages) flash notification rendering helper
|
||||
* [express-namespace](http://github.com/visionmedia/express-namespace) namespaced route support
|
||||
* [express-params](https://github.com/visionmedia/express-params) param pre-condition functions
|
||||
* [express-mongoose](https://github.com/LearnBoost/express-mongoose) plugin for easy rendering of Mongoose async Query results
|
||||
* Follow [tjholowaychuk](http://twitter.com/tjholowaychuk) on twitter for updates
|
||||
* [Google Group](http://groups.google.com/group/express-js) for discussion
|
||||
* Visit the [Wiki](http://github.com/visionmedia/express/wiki)
|
||||
|
||||
+15
-43
@@ -11,7 +11,7 @@ var fs = require('fs')
|
||||
* Framework version.
|
||||
*/
|
||||
|
||||
var version = '2.3.7';
|
||||
var version = '2.3.11';
|
||||
|
||||
/**
|
||||
* Add session support.
|
||||
@@ -149,33 +149,6 @@ var stylus = [
|
||||
, ' color #00B7FF'
|
||||
].join('\n');
|
||||
|
||||
/**
|
||||
* App test template.
|
||||
*/
|
||||
|
||||
var appTest = [
|
||||
""
|
||||
, "// Run $ expresso"
|
||||
, ""
|
||||
, "/**"
|
||||
, " * Module dependencies."
|
||||
, " */"
|
||||
, ""
|
||||
, "var app = require('../app')"
|
||||
, " , assert = require('assert');"
|
||||
, "",
|
||||
, "module.exports = {"
|
||||
, " 'GET /': function(){"
|
||||
, " assert.response(app,"
|
||||
, " { url: '/' },"
|
||||
, " { status: 200, headers: { 'Content-Type': 'text/html; charset=utf-8' }},"
|
||||
, " function(res){"
|
||||
, " assert.includes(res.body, '<title>Express</title>');"
|
||||
, " });"
|
||||
, " }"
|
||||
, "};"
|
||||
].join('\n');
|
||||
|
||||
/**
|
||||
* App template.
|
||||
*/
|
||||
@@ -318,9 +291,6 @@ function createApplicationAt(path) {
|
||||
break;
|
||||
}
|
||||
});
|
||||
mkdir(path + '/test', function(){
|
||||
write(path + '/test/app.test.js', appTest);
|
||||
});
|
||||
|
||||
// CSS Engine support
|
||||
switch (cssEngine) {
|
||||
@@ -343,19 +313,21 @@ function createApplicationAt(path) {
|
||||
// Template support
|
||||
app = app.replace(':TEMPLATE', templateEngine);
|
||||
|
||||
write(path + '/app.js', app);
|
||||
// package.json
|
||||
var json = '{\n';
|
||||
json += ' "name": "application-name"\n';
|
||||
json += ' , "version": "0.0.1"\n';
|
||||
json += ' , "private": true\n';
|
||||
json += ' , "dependencies": {\n';
|
||||
json += ' "express": "' + version + '"\n';
|
||||
if (cssEngine) json += ' , "' + cssEngine + '": ">= 0.0.1"\n';
|
||||
if (templateEngine) json += ' , "' + templateEngine + '": ">= 0.0.1"\n';
|
||||
json += ' }\n';
|
||||
json += '}';
|
||||
|
||||
// Suggestions
|
||||
process.on('exit', function(){
|
||||
if (cssEngine) {
|
||||
console.log(' - make sure you have installed %s: \x1b[33m$ npm install %s\x1b[0m'
|
||||
, cssEngine
|
||||
, cssEngine);
|
||||
}
|
||||
console.log(' - make sure you have installed %s: \x1b[33m$ npm install %s\x1b[0m'
|
||||
, templateEngine
|
||||
, templateEngine);
|
||||
});
|
||||
|
||||
write(path + '/package.json', json);
|
||||
write(path + '/app.js', app);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -192,10 +192,9 @@
|
||||
</ul>
|
||||
<h3>Development Dependencies</h3>
|
||||
|
||||
<p>Express development dependencies are stored within the <em>./support</em> directory. To
|
||||
update them execute:</p>
|
||||
<p>First install the dev dependencies by executing the following command in the repo’s directory:</p>
|
||||
|
||||
<pre><code>$ git submodule update --init
|
||||
<pre><code>$ npm install
|
||||
</code></pre>
|
||||
|
||||
<h3>Running Tests</h3>
|
||||
|
||||
+26
-11
@@ -255,6 +255,31 @@
|
||||
<pre><code>$ npm install express
|
||||
</code></pre>
|
||||
|
||||
<p>or to access the <code>express(1)</code> executable install globally:</p>
|
||||
|
||||
<pre><code>$ npm install -g express
|
||||
</code></pre>
|
||||
|
||||
<h2>Quick Start</h2>
|
||||
|
||||
<p> The quickest way to get started with express is to utilize the executable <code>express(1)</code> to generate an application as shown below:</p>
|
||||
|
||||
<p> Create the app:</p>
|
||||
|
||||
<pre><code>$ npm install -g express
|
||||
$ express /tmp/foo && cd /tmp/foo
|
||||
</code></pre>
|
||||
|
||||
<p> Install dependencies:</p>
|
||||
|
||||
<pre><code>$ npm install -d
|
||||
</code></pre>
|
||||
|
||||
<p> Start the server:</p>
|
||||
|
||||
<pre><code>$ node app.js
|
||||
</code></pre>
|
||||
|
||||
<h3 id="creating-a server">Creating A Server</h3>
|
||||
|
||||
<p> To create an instance of the <em>express.HTTPServer</em>, simply invoke the <em>createServer()</em> method. With our instance <em>app</em> we can then define routes based on the HTTP verbs, in this example <em>app.get()</em>.</p>
|
||||
@@ -505,7 +530,7 @@ var app = express.createServer(
|
||||
|
||||
<p>Alternatively we can <em>use()</em> them which is useful when adding middleware within <em>configure()</em> blocks, in a progressive manor.</p>
|
||||
|
||||
<pre><code>app.use(express.logger({ format: ':method :uri' }));
|
||||
<pre><code>app.use(express.logger({ format: ':method :url' }));
|
||||
</code></pre>
|
||||
|
||||
<p>Typically with connect middleware you would <em>require(‘connect’)</em> like so:</p>
|
||||
@@ -772,16 +797,6 @@ is present, which is useful for developing apps that rely heavily on client-side
|
||||
});
|
||||
</code></pre>
|
||||
|
||||
<p>For simple cases such as route placeholder validation and coercion we can simple pass a callback which has an arity of 1 (accepts one argument). Any errors thrown will be passed to <em>next(err)</em>.</p>
|
||||
|
||||
<pre><code>app.param('number', function(n){ return parseInt(n, 10); });
|
||||
</code></pre>
|
||||
|
||||
<p>We may also apply the same callback to several placeholders, for example a route GET <em>/commits/:from-:to</em> are both numbers, so we may define them as an array:</p>
|
||||
|
||||
<pre><code>app.param(['from', 'to'], function(n){ return parseInt(n, 10); });
|
||||
</code></pre>
|
||||
|
||||
<h3 id="view-rendering">View Rendering</h3>
|
||||
|
||||
<p>View filenames take the form “<name>.<engine>”, where <engine> is the name
|
||||
|
||||
+21
-8
@@ -2,6 +2,27 @@
|
||||
|
||||
$ npm install express
|
||||
|
||||
or to access the `express(1)` executable install globally:
|
||||
|
||||
$ npm install -g express
|
||||
|
||||
## Quick Start
|
||||
|
||||
The quickest way to get started with express is to utilize the executable `express(1)` to generate an application as shown below:
|
||||
|
||||
Create the app:
|
||||
|
||||
$ npm install -g express
|
||||
$ express /tmp/foo && cd /tmp/foo
|
||||
|
||||
Install dependencies:
|
||||
|
||||
$ npm install -d
|
||||
|
||||
Start the server:
|
||||
|
||||
$ node app.js
|
||||
|
||||
### Creating A Server
|
||||
|
||||
To create an instance of the _express.HTTPServer_, simply invoke the _createServer()_ method. With our instance _app_ we can then define routes based on the HTTP verbs, in this example _app.get()_.
|
||||
@@ -480,14 +501,6 @@ Doing so, as mentioned drastically improves our route readability, and allows us
|
||||
res.send('user ' + req.user.name);
|
||||
});
|
||||
|
||||
For simple cases such as route placeholder validation and coercion we can simple pass a callback which has an arity of 1 (accepts one argument). Any errors thrown will be passed to _next(err)_.
|
||||
|
||||
app.param('number', function(n){ return parseInt(n, 10); });
|
||||
|
||||
We may also apply the same callback to several placeholders, for example a route GET _/commits/:from-:to_ are both numbers, so we may define them as an array:
|
||||
|
||||
app.param(['from', 'to'], function(n){ return parseInt(n, 10); });
|
||||
|
||||
### View Rendering
|
||||
|
||||
View filenames take the form "<name>.<engine>", where <engine> is the name
|
||||
|
||||
@@ -11,7 +11,7 @@ var app = express.createServer(
|
||||
express.favicon(),
|
||||
|
||||
// Custom logger format
|
||||
express.logger({ format: '\x1b[1m:method\x1b[0m \x1b[33m:url\x1b[0m :response-time' }),
|
||||
express.logger({ format: '\x1b[36m:method\x1b[0m \x1b[90m:url\x1b[0m :response-time' }),
|
||||
|
||||
// Provides req.cookies
|
||||
express.cookieParser(),
|
||||
@@ -36,9 +36,8 @@ app.get('/forget', function(req, res){
|
||||
});
|
||||
|
||||
app.post('/', function(req, res){
|
||||
if (req.body.remember) {
|
||||
res.cookie('remember', '1', { path: '/', expires: new Date(Date.now() + 900000), httpOnly: true });
|
||||
}
|
||||
var minute = 60000;
|
||||
if (req.body.remember) res.cookie('remember', 1, { maxAge: minute });
|
||||
res.redirect('back');
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ var exports = module.exports = connect.middleware;
|
||||
* Framework version.
|
||||
*/
|
||||
|
||||
exports.version = '2.3.7';
|
||||
exports.version = '2.3.11';
|
||||
|
||||
/**
|
||||
* Shortcut for `new Server(...)`.
|
||||
|
||||
+1
-1
@@ -106,7 +106,7 @@ res.send = function(body, headers, status){
|
||||
}
|
||||
|
||||
// strip irrelevant headers
|
||||
if (204 === status) {
|
||||
if (204 == status) {
|
||||
this.removeHeader('Content-Type');
|
||||
this.removeHeader('Content-Length');
|
||||
}
|
||||
|
||||
@@ -193,10 +193,10 @@ Router.prototype._dispatch = function(req, res, next){
|
||||
}
|
||||
|
||||
// match route
|
||||
route = self._match(req, i);
|
||||
req.route = route = self._match(req, i);
|
||||
|
||||
// implied OPTIONS
|
||||
if ('OPTIONS' == req.method) return self._options(req, res);
|
||||
if (!route && 'OPTIONS' == req.method) return self._options(req, res);
|
||||
|
||||
// no route
|
||||
if (!route) return next();
|
||||
@@ -209,8 +209,8 @@ Router.prototype._dispatch = function(req, res, next){
|
||||
|
||||
(function param(err) {
|
||||
var key = keys[i++]
|
||||
, val = req.params[key]
|
||||
, fn = params[key]
|
||||
, val = key && req.params[key.name]
|
||||
, fn = key && params[key.name]
|
||||
, ret;
|
||||
|
||||
try {
|
||||
@@ -218,7 +218,7 @@ Router.prototype._dispatch = function(req, res, next){
|
||||
nextRoute();
|
||||
} else if (err) {
|
||||
next(err);
|
||||
} else if (fn) {
|
||||
} else if (fn && undefined !== val) {
|
||||
fn(req, res, param, val);
|
||||
} else if (key) {
|
||||
param();
|
||||
@@ -281,7 +281,7 @@ Router.prototype._optionsFor = function(path){
|
||||
var self = this;
|
||||
return methods.filter(function(method){
|
||||
var routes = self.routes[method];
|
||||
if (!routes) return;
|
||||
if (!routes || 'options' == method) return;
|
||||
for (var i = 0, len = routes.length; i < len; ++i) {
|
||||
if (routes[i].match(path)) return true;
|
||||
}
|
||||
@@ -329,7 +329,7 @@ Router.prototype._match = function(req, i){
|
||||
? decodeURIComponent(captures[j])
|
||||
: captures[j];
|
||||
if (key) {
|
||||
route.params[key] = val;
|
||||
route.params[key.name] = val;
|
||||
} else {
|
||||
route.params.push(val);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ function normalize(path, keys, sensitive) {
|
||||
.concat('/?')
|
||||
.replace(/\/\(/g, '(?:/')
|
||||
.replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g, function(_, slash, format, key, capture, optional){
|
||||
keys.push(key);
|
||||
keys.push({ name: key, optional: !! optional });
|
||||
slash = slash || '';
|
||||
return ''
|
||||
+ (optional ? '' : slash)
|
||||
|
||||
+1
-6
@@ -127,11 +127,6 @@ exports.lookup = function(view, options){
|
||||
function renderPartial(res, view, options, parentLocals, parent){
|
||||
var collection, object, locals;
|
||||
|
||||
// Inherit parent view extension when not present
|
||||
if (parent && !~view.indexOf('.')) {
|
||||
view += parent.extension;
|
||||
}
|
||||
|
||||
if (options) {
|
||||
// collection
|
||||
if (options.collection) {
|
||||
@@ -269,7 +264,7 @@ res.partial = function(view, options, fn){
|
||||
parent.dirname = app.set('views') || process.cwd() + '/views';
|
||||
|
||||
// utilize "view engine" option
|
||||
if (viewEngine) parent.extension = '.' + viewEngine;
|
||||
if (viewEngine) parent.engine = viewEngine;
|
||||
|
||||
// render the partial
|
||||
try {
|
||||
|
||||
+5
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "express",
|
||||
"description": "Sinatra inspired web development framework",
|
||||
"version": "2.3.7",
|
||||
"version": "2.3.11",
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"contributors": [
|
||||
{ "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" },
|
||||
@@ -30,5 +30,9 @@
|
||||
"repository": "git://github.com/visionmedia/express",
|
||||
"main": "index",
|
||||
"bin": { "express": "./bin/express" },
|
||||
"scripts": {
|
||||
"test": "make test",
|
||||
"prepublish" : "npm prune"
|
||||
},
|
||||
"engines": { "node": ">= 0.4.1 < 0.5.0" }
|
||||
}
|
||||
@@ -461,5 +461,17 @@ module.exports = {
|
||||
assert.response(app,
|
||||
{ url: '/another' },
|
||||
{ body: 'got /another' });
|
||||
},
|
||||
|
||||
'invalid chars': function(){
|
||||
var app = express.createServer();
|
||||
|
||||
app.get('/:name', function(req, res, next){
|
||||
res.send('invalid');
|
||||
});
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/%a0' },
|
||||
{ status: 500 });
|
||||
}
|
||||
};
|
||||
|
||||
externo
+3
-1
@@ -1 +1,3 @@
|
||||
h1 Forum Thread
|
||||
h1 Forum Thread
|
||||
!= partial('../hello')
|
||||
!= partial('../hello.haml')
|
||||
+107
-3
@@ -74,6 +74,38 @@ module.exports = {
|
||||
});
|
||||
},
|
||||
|
||||
'test precedence': function(){
|
||||
var app = express.createServer();
|
||||
|
||||
var hits = [];
|
||||
|
||||
app.all('*', function(req, res, next){
|
||||
hits.push('all');
|
||||
next();
|
||||
});
|
||||
|
||||
app.get('/foo', function(req, res, next){
|
||||
hits.push('GET /foo');
|
||||
next();
|
||||
});
|
||||
|
||||
app.get('/foo', function(req, res, next){
|
||||
hits.push('GET /foo2');
|
||||
next();
|
||||
});
|
||||
|
||||
app.put('/foo', function(req, res, next){
|
||||
hits.push('PUT /foo');
|
||||
next();
|
||||
});
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/foo' },
|
||||
function(){
|
||||
hits.should.eql(['all', 'GET /foo', 'GET /foo2']);
|
||||
});
|
||||
},
|
||||
|
||||
'test named capture groups': function(){
|
||||
var app = express.createServer();
|
||||
|
||||
@@ -106,7 +138,7 @@ module.exports = {
|
||||
{ body: 'Cannot GET /user/ab' });
|
||||
},
|
||||
|
||||
'test .param()': function(){
|
||||
'test app.param()': function(){
|
||||
var app = express.createServer();
|
||||
|
||||
var users = [
|
||||
@@ -137,6 +169,35 @@ module.exports = {
|
||||
{ url: '/user/1' },
|
||||
{ body: 'user tobi' });
|
||||
},
|
||||
|
||||
'test app.param() optional execution': function(beforeExit){
|
||||
var app = express.createServer()
|
||||
, calls = 0;
|
||||
|
||||
var months = ['Jan', 'Feb', 'Mar'];
|
||||
|
||||
app.param('month', function(req, res, next, n){
|
||||
req.params.month = months[n];
|
||||
++calls;
|
||||
next();
|
||||
});
|
||||
|
||||
app.get('/calendar/:month?', function(req, res, next){
|
||||
res.send(req.params.month || months[0]);
|
||||
});
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/calendar' },
|
||||
{ body: 'Jan' });
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/calendar/1' },
|
||||
{ body: 'Feb' });
|
||||
|
||||
beforeExit(function(){
|
||||
calls.should.equal(1);
|
||||
});
|
||||
},
|
||||
|
||||
'test OPTIONS': function(){
|
||||
var app = express.createServer();
|
||||
@@ -168,7 +229,7 @@ module.exports = {
|
||||
route.path.should.equal('/user/:id');
|
||||
route.regexp.should.be.an.instanceof(RegExp);
|
||||
route.method.should.equal('get');
|
||||
route.keys.should.eql(['id']);
|
||||
route.keys.should.eql([{ name: 'id', optional: false }]);
|
||||
|
||||
app.get('/user').should.have.length(1);
|
||||
app.get('/user/:id').should.have.length(1);
|
||||
@@ -230,7 +291,7 @@ module.exports = {
|
||||
route.path.should.equal('/user/:id');
|
||||
route.regexp.should.be.an.instanceof(RegExp);
|
||||
route.method.should.equal('get');
|
||||
route.keys.should.eql(['id']);
|
||||
route.keys.should.eql([{ name: 'id', optional: false }]);
|
||||
//route.params.id.should.equal('12');
|
||||
|
||||
app.match.get('/user').should.have.length(1);
|
||||
@@ -277,5 +338,48 @@ module.exports = {
|
||||
assert.response(app,
|
||||
{ url: '/Account' },
|
||||
{ body: 'Account' });
|
||||
},
|
||||
|
||||
'override OPTIONS default': function(){
|
||||
var app = express.createServer();
|
||||
|
||||
app.get('/', function(req, res, next){
|
||||
|
||||
});
|
||||
|
||||
app.options('/foo', function(req, res, next){
|
||||
res.header('Allow', 'GET')
|
||||
res.send('whatever');
|
||||
});
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/', method: 'OPTIONS' },
|
||||
{ body: 'GET', headers: { Allow: 'GET' }});
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/foo', method: 'OPTIONS' },
|
||||
{ body: 'whatever', headers: { Allow: 'GET' }});
|
||||
},
|
||||
|
||||
'test req.route': function(){
|
||||
var app = express.createServer();
|
||||
|
||||
var routes = [];
|
||||
|
||||
app.get('/:foo?', function(req, res, next){
|
||||
routes.push(req.route.path);
|
||||
next();
|
||||
});
|
||||
|
||||
app.get('/foo', function(req, res, next){
|
||||
routes.push(req.route.path);
|
||||
next();
|
||||
});
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/foo' },
|
||||
function(){
|
||||
routes.should.eql(['/:foo?', '/foo']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -668,6 +668,67 @@ module.exports = {
|
||||
{ body: '<p>two</p>' });
|
||||
},
|
||||
|
||||
'test #partial() relative lookup with "view engine"': function(){
|
||||
var app = create();
|
||||
app.set('view engine', 'jade');
|
||||
|
||||
app.get('/', function(req, res, next){
|
||||
res.render('forum/thread', { layout: false });
|
||||
});
|
||||
|
||||
app.get('/2', function(req, res, next){
|
||||
res.render('forum/../forum/thread', { layout: false });
|
||||
});
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/2' },
|
||||
{ body: '<h1>Forum Thread</h1><p>:(</p>\n<p>Hello World</p>' });
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/' },
|
||||
{ body: '<h1>Forum Thread</h1><p>:(</p>\n<p>Hello World</p>' });
|
||||
},
|
||||
|
||||
'test #partial() relative lookup without "view engine"': function(){
|
||||
var app = create();
|
||||
|
||||
app.get('/', function(req, res, next){
|
||||
res.render('forum/thread.jade', { layout: false });
|
||||
});
|
||||
|
||||
app.get('/2', function(req, res, next){
|
||||
res.render('forum/../forum/thread.jade', { layout: false });
|
||||
});
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/2' },
|
||||
{ body: '<h1>Forum Thread</h1><p>:(</p>\n<p>Hello World</p>' });
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/' },
|
||||
{ body: '<h1>Forum Thread</h1><p>:(</p>\n<p>Hello World</p>' });
|
||||
},
|
||||
|
||||
'test #partial() relative lookup': function(){
|
||||
var app = create();
|
||||
|
||||
app.get('/', function(req, res, next){
|
||||
res.partial('forum/thread.jade');
|
||||
});
|
||||
|
||||
app.get('/2', function(req, res, next){
|
||||
res.partial('forum/../forum/thread.jade');
|
||||
});
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/2' },
|
||||
{ body: '<h1>Forum Thread</h1><p>:(</p>\n<p>Hello World</p>' });
|
||||
|
||||
assert.response(app,
|
||||
{ url: '/' },
|
||||
{ body: '<h1>Forum Thread</h1><p>:(</p>\n<p>Hello World</p>' });
|
||||
},
|
||||
|
||||
'test #partial() with several calls': function(){
|
||||
var app = create();
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário