Comparar commits

...

72 Commits

Autor SHA1 Mensagem Data
Tj Holowaychuk 68a58e2fdf Release 1.0.5 2011-02-05 11:16:21 -08:00
Tj Holowaychuk 28361c9279 Added secret to generated app 2011-02-05 11:15:48 -08:00
Tj Holowaychuk 82e15cf321 Release 1.0.4 2011-02-05 11:13:08 -08:00
Tj Holowaychuk 4c0825b670 Added qs dep 2011-02-05 11:12:00 -08:00
Tj Holowaychuk f353aa3384 Added qs submod for testing 2011-02-05 11:11:34 -08:00
Tj Holowaychuk a7eacec1f2 Fixed namespaced requires 2011-02-05 11:10:47 -08:00
Tj Holowaychuk 5ecec0a492 Updated connect submodule 2011-02-05 11:09:41 -08:00
Tj Holowaychuk 8c7241db02 connect >= 0.5.x 2011-02-01 08:33:45 -08:00
Tj Holowaychuk 107ebcb0c1 Updated connect submodule 2011-02-01 08:33:14 -08:00
Tj Holowaychuk 7dd93a5d55 generate docs 2011-01-29 12:20:47 -08:00
Tj Holowaychuk c41c99e18a Added eco template engine 2011-01-29 12:20:10 -08:00
Tj Holowaychuk 5b50b48e08 docs for session secret 2011-01-29 12:19:19 -08:00
Tj Holowaychuk 077e09f922 more req.flash() docs 2011-01-29 12:17:20 -08:00
Tj Holowaychuk 059803b5bc updated jade 2011-01-29 12:14:15 -08:00
Tj Holowaychuk 59d18d245f Added tests to confirm that partials in layouts work 2011-01-25 10:13:15 -08:00
Tj Holowaychuk a481ddf9bf Fixed session related tests for updated connect 2011-01-15 19:42:34 -08:00
Tj Holowaychuk b1042abbe3 Updated connect submodule 2011-01-15 19:41:35 -08:00
Tj Holowaychuk cb1f536eb5 Release 1.0.3 2011-01-13 14:09:00 -08:00
Ryan Grove 7791169810 Remove unsafe characters from JSONP callback names.
This prevents JSONP callbacks from being used as an XSS vector. The set
of acceptable characters is intentionally more limited than the full
set of valid characters in JS identifiers in order to avoid complexity,
but this could be expanded in the future if necessary.
2011-01-13 14:06:57 -08:00
Tj Holowaychuk 1b854f4297 Added .gitignore 2011-01-10 18:11:23 -08:00
Tj Holowaychuk 52353da08b Release 1.0.2 2011-01-10 18:09:16 -08:00
Tj Holowaychuk dc56b9b603 Removed nested require, using connect.router 2011-01-10 18:08:33 -08:00
Tj Holowaychuk 1446135545 docs 2011-01-03 13:33:51 -08:00
Tj Holowaychuk cdc46307d7 Release 1.0.1 2010-12-29 11:38:02 -08:00
Tj Holowaychuk dbf02c231a Fixed for middleware stacked via createServer() 2010-12-29 11:34:27 -08:00
Tj Holowaychuk 4732185e6f Fixed express(1) generated tests for express 0.7.0. Closes #484 2010-12-14 08:22:38 -08:00
Tj Holowaychuk 84a95b3101 Updated connect submodule 2010-12-06 14:54:50 -08:00
Tj Holowaychuk 09e8fe280b older expresso 2010-11-24 08:16:59 -08:00
Tj Holowaychuk 0e4ea9c16b Updated jade submodule 2010-11-24 08:14:44 -08:00
Tj Holowaychuk c7542aef95 Merge branch 'master' into 1.x 2010-11-17 11:26:55 -08:00
Tj Holowaychuk 6873bce6c6 Merge branch 'master' into 1.x 2010-11-16 18:04:57 -08:00
Tj Holowaychuk 6ddacb6302 Merge branch 'master' into 1.x 2010-11-16 17:58:33 -08:00
Tj Holowaychuk e1d33992a7 Merge branch 'master' into 1.x 2010-11-13 10:55:19 -08:00
Tj Holowaychuk 569c5139a6 Merge branch 'master' into 1.x 2010-11-12 08:46:07 -08:00
Tj Holowaychuk 6f5f5787e2 Merge branch 'master' into 1.x 2010-11-08 07:18:52 -08:00
Tj Holowaychuk 94cf769dd7 Merge branch 'master' into 1.x 2010-10-26 12:09:17 -07:00
Tj Holowaychuk 6d00b45eed Merge branch 'master' into 1.x 2010-10-26 01:18:24 -07:00
Tj Holowaychuk 6a4c6933aa Merge branch 'master' into 1.x 2010-10-22 16:20:47 -07:00
Tj Holowaychuk c35ee2427e Merge branch 'master' into 1.x 2010-10-21 19:53:39 -07:00
Tj Holowaychuk 3d7216935a Merge branch 'master' into 1.x 2010-10-20 10:07:54 -07:00
Tj Holowaychuk fc15c3d02b Merge branch 'master' into 1.x 2010-10-19 17:19:39 -07:00
Tj Holowaychuk 9eaec5b34e Merge branch 'master' into 1.x 2010-10-19 17:03:18 -07:00
Tj Holowaychuk 30712fa9d9 Merge branch 'master' into 1.x 2010-10-19 15:03:02 -07:00
Tj Holowaychuk b817579d8a Merge branch 'master' into 1.x 2010-10-19 09:20:23 -07:00
Tj Holowaychuk cbcaba3cec Merge branch 'master' into 1.x 2010-10-15 10:02:29 -07:00
Tj Holowaychuk 4e11fef43b Merge branch 'master' into 1.x 2010-10-15 08:26:04 -07:00
Tj Holowaychuk 067fdd5c4c Merge branch 'master' into 1.x 2010-10-14 09:08:19 -07:00
Tj Holowaychuk fff815f666 Merge branch 'master' into 1.x 2010-10-14 04:17:19 -07:00
Tj Holowaychuk 609c18aa5b Merge branch 'master' into 1.x 2010-10-14 03:50:56 -07:00
Tj Holowaychuk 73c108ce90 Merge branch 'master' into 1.x 2010-10-14 03:03:24 -07:00
Tj Holowaychuk 1e9da205a7 Merge branch 'master' into 1.x 2010-10-12 12:59:14 -07:00
Tj Holowaychuk d5539c7beb Merge branch 'master' into 1.x 2010-10-12 08:46:48 -07:00
Tj Holowaychuk f87bd8c38f Merge branch 'master' into 1.x 2010-10-11 08:37:49 -07:00
Tj Holowaychuk 05515fa09e Merge branch 'master' into 1.x 2010-10-11 08:18:01 -07:00
Tj Holowaychuk 35c91ed6f5 Merge branch 'master' into 1.x 2010-10-08 11:39:14 -07:00
Tj Holowaychuk 26238c429d Merge branch 'master' into 1.x 2010-10-07 06:35:27 -07:00
Tj Holowaychuk 1b28ad16d4 Merge branch 'master' into 1.x 2010-10-07 05:46:45 -07:00
Tj Holowaychuk e29f3aa5dd Merge branch 'master' into 1.x 2010-10-07 03:50:02 -07:00
Tj Holowaychuk 5c94603787 Merge branch 'master' into 1.x 2010-10-07 02:36:41 -07:00
Tj Holowaychuk 9409107f77 Merge branch 'master' into 1.x 2010-10-06 08:26:29 -07:00
Tj Holowaychuk 7f11aa25ea Merge branch 'master' into 1.x 2010-10-05 06:32:50 -07:00
Tj Holowaychuk 1994f24d82 Merge branch 'master' into 1.x 2010-10-04 11:16:56 -07:00
Tj Holowaychuk b5b30a3f20 Merge branch 'master' into 1.x 2010-10-04 11:06:33 -07:00
Tj Holowaychuk 4fcbb961eb Merge branch 'master' into 1.x 2010-10-04 08:04:12 -07:00
Tj Holowaychuk 11cfad755a Merge branch 'master' into 1.x 2010-10-04 08:01:30 -07:00
Tj Holowaychuk 0b24bd08c9 Merge branch 'master' into 1.x 2010-10-01 16:33:34 -07:00
Tj Holowaychuk b377839538 Merge branch 'master' into 1.x 2010-10-01 16:31:40 -07:00
Tj Holowaychuk 698d82f799 Merge branch 'master' into 1.x 2010-10-01 07:34:14 -07:00
Tj Holowaychuk 462a291eb8 Merge branch 'master' into 1.x 2010-09-23 09:37:05 -07:00
Tj Holowaychuk 79dc2467f7 Merge branch 'master' into 1.x 2010-09-22 16:09:15 -07:00
Tj Holowaychuk 0a0c86813d Merge branch 'master' into 1.x 2010-09-22 12:03:42 -07:00
Tj Holowaychuk dfdc939816 Multipart typo 2010-09-21 12:39:14 -07:00
24 arquivos alterados com 152 adições e 72 exclusões
+3
Ver Arquivo
@@ -16,3 +16,6 @@
[submodule "support/jade"]
path = support/jade
url = git://github.com/visionmedia/jade.git
[submodule "support/qs"]
path = support/qs
url = git://github.com/visionmedia/node-querystring.git
+4
Ver Arquivo
@@ -0,0 +1,4 @@
test
support
examples
docs
+29
Ver Arquivo
@@ -1,4 +1,33 @@
1.0.5 / 2011-02-05
==================
* Added secret to generated app `session()` call
1.0.4 / 2011-02-05
==================
* Added `qs` dependency to _package.json_
* Fixed namespaced `require()`s for latest connect support
1.0.3 / 2011-01-13
==================
* Remove unsafe characters from JSONP callback names [Ryan Grove]
1.0.2 / 2011-01-10
==================
* Removed nested require, using `connect.router`
1.0.1 / 2010-12-29
==================
* Fixed for middleware stacked via `createServer()`
previously the `foo` middleware passed to `createServer(foo)`
would not have access to Express methods such as `res.send()`
or props like `req.query` etc.
1.0.0 / 2010-11-16
==================
+1
Ver Arquivo
@@ -38,6 +38,7 @@ uninstall-docs:
test:
@NODE_ENV=test ./support/expresso/bin/expresso \
-I lib \
-I support \
-I support/connect/lib \
-I support/haml/lib \
-I support/jade/lib \
+1 -1
Ver Arquivo
@@ -69,7 +69,7 @@ The following are the major contributors of Express (in no specific order).
The latest release of Express is compatible with node --version:
v0.2.4
v0.2.5
and connect --version:
+5 -4
Ver Arquivo
@@ -12,7 +12,7 @@ var fs = require('fs')
* Framework version.
*/
var version = '1.0.0';
var version = '1.0.5';
/**
* stdin stream.
@@ -145,10 +145,11 @@ var appTest = [
, " * Module dependencies."
, " */"
, ""
, "var app = require('../app');"
, "var app = require('../app')"
, " , assert = require('assert');"
, "",
, "module.exports = {"
, " 'GET /': function(assert){"
, " 'GET /': function(){"
, " assert.response(app,"
, " { url: '/' },"
, " { status: 200, headers: { 'Content-Type': 'text/html; charset=utf-8' }},"
@@ -320,7 +321,7 @@ function createApplicationAt(path) {
// Session support
app = app.replace(':SESS', sessions
? '\n app.use(express.cookieDecoder());\n app.use(express.session());'
? '\n app.use(express.cookieDecoder());\n app.use(express.session({ secret: \'your secret here\' }));'
: '');
// Template support
+15 -22
Ver Arquivo
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GUIDE" "" "November 2010" "" ""
.TH "GUIDE" "" "January 2011" "" ""
.
.SH "NAME"
\fBguide\fR
@@ -32,21 +32,6 @@ $ npm install express
.
.IP "" 0
.
.P
git clone, first update the submodules:
.
.IP "" 4
.
.nf
$ git submodule update \-\-init
$ make install
$ make install\-support
.
.fi
.
.IP "" 0
.
.SS "Creating An Application"
The \fIexpress\.Server\fR now inherits from \fIhttp\.Server\fR, however follows the same idiom by providing \fIexpress\.createServer()\fR as shown below\. This means that you can utilize Express server\'s transparently with other libraries\.
.
@@ -80,14 +65,16 @@ app\.configure(function(){
app\.use(express\.methodOverride());
app\.use(express\.bodyDecoder());
app\.use(app\.router);
app\.use(express\.staticProvider(__dirname + \'/public\'));
});
app\.configure(\'development\', function(){
app\.use(express\.staticProvider(__dirname + \'/public\'));
app\.use(express\.errorHandler({ dumpExceptions: true, showStack: true }));
});
app\.configure(\'production\', function(){
var oneYear = 31557600000;
app\.use(express\.staticProvider({ root: __dirname + \'/public\', maxAge: oneYear }));
app\.use(express\.errorHandler());
});
.
@@ -938,19 +925,22 @@ EJS \fIhttp://github\.com/visionmedia/ejs\fR Embedded JavaScript
CoffeeKup \fIhttp://github\.com/mauricemach/coffeekup\fR CoffeeScript based templating
.
.IP "\(bu" 4
Eco \fIhttp://github\.com/sstephenson/eco\fR Embedded CoffeeScript
.
.IP "\(bu" 4
jQuery Templates \fIhttps://github\.com/kof/node\-jqtpl\fR for node
.
.IP "" 0
.
.SS "Session Support"
Sessions support can be added by using Connect\'s \fIsession\fR middleware\. To do so we also need the \fIcookieDecoder\fR middleware place above it, which will parse and populate cookie data to \fIreq\.cookies\fR\.
Sessions support can be added by using Connect\'s \fIsession\fR middleware\. To do so we also need the \fIcookieDecoder\fR middleware place above it, which will parse and populate cookie data to \fIreq\.cookies\fR\. The session middleware requires only a \fBsecret\fR\.
.
.IP "" 4
.
.nf
app\.use(express\.cookieDecoder());
app\.use(express\.session());
app\.use(express\.session({ secret: \'keyboard cat\' }));
.
.fi
.
@@ -965,7 +955,7 @@ By default the \fIsession\fR middleware uses the memory store bundled with Conne
var RedisStore = require(\'connect\-redis\');
app\.use(express\.cookieDecoder());
app\.use(express\.session({ store: new RedisStore }));
app\.use(express\.session({ store: new RedisStore, secret: \'keyboard cat\' }));
.
.fi
.
@@ -981,7 +971,7 @@ Now the \fIreq\.session\fR and \fIreq\.sessionStore\fR properties will be access
var RedisStore = require(\'connect\-redis\');
app\.use(express\.bodyDecoder());
app\.use(express\.cookieDecoder());
app\.use(express\.session({ store: new RedisStore }));
app\.use(express\.session({ store: new RedisStore, secret: \'keyboard cat\' }));
app\.post(\'/add\-to\-cart\', function(req, res){
// Perhaps we posted several items with a form
@@ -1160,7 +1150,7 @@ Checks urlencoded body params (\fIreq\.body\fR), ex: id=12
To utilize urlencoded request bodies, \fIreq\.body\fR should be an object\. This can be done by using the \fIexpress\.bodyDecoder\fR middleware\.
.
.SS "req\.flash(type[, msg])"
Queue flash \fImsg\fR of the given \fItype\fR\.
Queue flash \fImsg\fR of the given \fItype\fR\. These messages are stored in the session (thus requiring the \fBsession\fR middleware), enabling them to span one or more requests before flushing\.
.
.IP "" 4
.
@@ -1197,6 +1187,9 @@ req\.flash(\'info\', \'email delivery to _%s_ from _%s_ failed\.\', toUser, from
.
.IP "" 0
.
.P
For HTML flash message check out the express\-contrib \fIhttps://github\.com/visionmedia/express\-contrib\fR library\.
.
.SS "req\.isXMLHttpRequest"
Also aliased as \fIreq\.xhr\fR, this getter checks the \fIX\-Requested\-With\fR header to see if it was issued by an \fIXMLHttpRequest\fR:
.
+11 -13
Ver Arquivo
@@ -257,13 +257,6 @@
<pre><code>$ npm install express
</code></pre>
<p>git clone, first update the submodules:</p>
<pre><code>$ git submodule update --init
$ make install
$ make install-support
</code></pre>
<h3 id="Creating-An-Application">Creating An Application</h3>
<p>The <em>express.Server</em> now inherits from <em>http.Server</em>, however
@@ -295,14 +288,16 @@ otherwise the first call to <em>app.{get,put,del,post}()</em> will mount the rou
app.use(express.methodOverride());
app.use(express.bodyDecoder());
app.use(app.router);
app.use(express.staticProvider(__dirname + '/public'));
});
app.configure('development', function(){
app.use(express.staticProvider(__dirname + '/public'));
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.configure('production', function(){
var oneYear = 31557600000;
app.use(express.staticProvider({ root: __dirname + '/public', maxAge: oneYear }));
app.use(express.errorHandler());
});
</code></pre>
@@ -822,23 +817,24 @@ for free:</p>
<li><a href="http://github.com/visionmedia/haml.js">Haml</a> pythonic indented templates</li>
<li><a href="http://github.com/visionmedia/ejs">EJS</a> Embedded JavaScript</li>
<li><a href="http://github.com/mauricemach/coffeekup">CoffeeKup</a> CoffeeScript based templating</li>
<li><a href="http://github.com/sstephenson/eco">Eco</a> Embedded CoffeeScript</li>
<li><a href="https://github.com/kof/node-jqtpl">jQuery Templates</a> for node</li>
</ul>
<h3 id="Session-Support">Session Support</h3>
<p>Sessions support can be added by using Connect's <em>session</em> middleware. To do so we also need the <em>cookieDecoder</em> middleware place above it, which will parse and populate cookie data to <em>req.cookies</em>.</p>
<p>Sessions support can be added by using Connect's <em>session</em> middleware. To do so we also need the <em>cookieDecoder</em> middleware place above it, which will parse and populate cookie data to <em>req.cookies</em>. The session middleware requires only a <code>secret</code>.</p>
<pre><code>app.use(express.cookieDecoder());
app.use(express.session());
app.use(express.session({ secret: 'keyboard cat' }));
</code></pre>
<p>By default the <em>session</em> middleware uses the memory store bundled with Connect, however many implementations exist. For example <a href="http://github.com/visionmedia/connect-redis">connect-redis</a> supplies a <a href="http://code.google.com/p/redis/">Redis</a> session store and can be used as shown below:</p>
<pre><code>var RedisStore = require('connect-redis');
app.use(express.cookieDecoder());
app.use(express.session({ store: new RedisStore }));
app.use(express.session({ store: new RedisStore, secret: 'keyboard cat' }));
</code></pre>
<p>Now the <em>req.session</em> and <em>req.sessionStore</em> properties will be accessible to all routes and subsequent middleware. Properties on <em>req.session</em> are automatically saved on a response, so for example if we wish to shopping cart data:</p>
@@ -846,7 +842,7 @@ app.use(express.session({ store: new RedisStore }));
<pre><code>var RedisStore = require('connect-redis');
app.use(express.bodyDecoder());
app.use(express.cookieDecoder());
app.use(express.session({ store: new RedisStore }));
app.use(express.session({ store: new RedisStore, secret: 'keyboard cat' }));
app.post('/add-to-cart', function(req, res){
// Perhaps we posted several items with a form
@@ -978,7 +974,7 @@ the <em>express.bodyDecoder</em> middleware.</p>
<h3 id="req-flash-type-msg-">req.flash(type[, msg])</h3>
<p>Queue flash <em>msg</em> of the given <em>type</em>.</p>
<p>Queue flash <em>msg</em> of the given <em>type</em>. These messages are stored in the session (thus requiring the <code>session</code> middleware), enabling them to span one or more requests before flushing.</p>
<pre><code>req.flash('info', 'email sent');
req.flash('error', 'email delivery failed');
@@ -1000,6 +996,8 @@ req.flash();
<pre><code>req.flash('info', 'email delivery to _%s_ from _%s_ failed.', toUser, fromUser);
</code></pre>
<p>For HTML flash message check out the <a href="https://github.com/visionmedia/express-contrib">express-contrib</a> library.</p>
<h3 id="req-isXMLHttpRequest">req.isXMLHttpRequest</h3>
<p>Also aliased as <em>req.xhr</em>, this getter checks the <em>X-Requested-With</em> header
+23 -18
Ver Arquivo
@@ -36,19 +36,21 @@ Note the use of _app.router_, which can (optionally) be used to mount the applic
otherwise the first call to _app.{get,put,del,post}()_ will mount the routes.
app.configure(function(){
app.use(express.methodOverride());
app.use(express.bodyDecoder());
app.use(app.router);
app.use(express.staticProvider(__dirname + '/public'));
});
app.configure('development', function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.configure('production', function(){
app.use(express.errorHandler());
});
app.use(express.methodOverride());
app.use(express.bodyDecoder());
app.use(app.router);
});
app.configure('development', function(){
app.use(express.staticProvider(__dirname + '/public'));
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.configure('production', function(){
var oneYear = 31557600000;
app.use(express.staticProvider({ root: __dirname + '/public', maxAge: oneYear }));
app.use(express.errorHandler());
});
For internal and arbitrary settings Express provides the _set(key[, val])_, _enable(key)_, _disable(key)_ methods:
@@ -515,27 +517,28 @@ Below are a few template engines commonly used with Express:
* [Haml](http://github.com/visionmedia/haml.js) pythonic indented templates
* [EJS](http://github.com/visionmedia/ejs) Embedded JavaScript
* [CoffeeKup](http://github.com/mauricemach/coffeekup) CoffeeScript based templating
* [Eco](http://github.com/sstephenson/eco) Embedded CoffeeScript
* [jQuery Templates](https://github.com/kof/node-jqtpl) for node
### Session Support
Sessions support can be added by using Connect's _session_ middleware. To do so we also need the _cookieDecoder_ middleware place above it, which will parse and populate cookie data to _req.cookies_.
Sessions support can be added by using Connect's _session_ middleware. To do so we also need the _cookieDecoder_ middleware place above it, which will parse and populate cookie data to _req.cookies_. The session middleware requires only a `secret`.
app.use(express.cookieDecoder());
app.use(express.session());
app.use(express.session({ secret: 'keyboard cat' }));
By default the _session_ middleware uses the memory store bundled with Connect, however many implementations exist. For example [connect-redis](http://github.com/visionmedia/connect-redis) supplies a [Redis](http://code.google.com/p/redis/) session store and can be used as shown below:
var RedisStore = require('connect-redis');
app.use(express.cookieDecoder());
app.use(express.session({ store: new RedisStore }));
app.use(express.session({ store: new RedisStore, secret: 'keyboard cat' }));
Now the _req.session_ and _req.sessionStore_ properties will be accessible to all routes and subsequent middleware. Properties on _req.session_ are automatically saved on a response, so for example if we wish to shopping cart data:
var RedisStore = require('connect-redis');
app.use(express.bodyDecoder());
app.use(express.cookieDecoder());
app.use(express.session({ store: new RedisStore }));
app.use(express.session({ store: new RedisStore, secret: 'keyboard cat' }));
app.post('/add-to-cart', function(req, res){
// Perhaps we posted several items with a form
@@ -656,7 +659,7 @@ the _express.bodyDecoder_ middleware.
### req.flash(type[, msg])
Queue flash _msg_ of the given _type_.
Queue flash _msg_ of the given _type_. These messages are stored in the session (thus requiring the `session` middleware), enabling them to span one or more requests before flushing.
req.flash('info', 'email sent');
req.flash('error', 'email delivery failed');
@@ -676,6 +679,8 @@ Flash notification message may also utilize formatters, by default only the %s s
req.flash('info', 'email delivery to _%s_ from _%s_ failed.', toUser, fromUser);
For HTML flash message check out the [express-contrib](https://github.com/visionmedia/express-contrib) library.
### req.isXMLHttpRequest
Also aliased as _req.xhr_, this getter checks the _X-Requested-With_ header
+1 -1
Ver Arquivo
@@ -15,7 +15,7 @@ var app = express.createServer(
// - req.session
// - req.sessionStore
// - req.sessionID
express.session()
express.session({ secret: 'keyboard cat' })
);
app.get('/', function(req, res){
+1 -1
Ver Arquivo
@@ -19,7 +19,7 @@ var exports = module.exports = require('connect').middleware;
* Framework version.
*/
exports.version = '1.0.0';
exports.version = '1.0.5';
/**
* Module dependencies.
+1 -1
Ver Arquivo
@@ -11,7 +11,7 @@
var http = require('http')
, utils = require('./utils')
, mime = require('connect/utils').mime;
, mime = require('connect').utils.mime;
/**
* Default flash formatters.
+3 -3
Ver Arquivo
@@ -13,8 +13,8 @@ var fs = require('fs')
, http = require('http')
, path = require('path')
, pump = require('sys').pump
, utils = require('connect/utils')
, mime = require('connect/utils').mime
, utils = require('connect').utils
, mime = utils.mime
, parseRange = require('./utils').parseRange;
/**
@@ -85,7 +85,7 @@ http.ServerResponse.prototype.send = function(body, headers, status){
body = JSON.stringify(body);
if (this.req.query.callback && this.app.settings['jsonp callback']) {
this.header('Content-Type', 'text/javascript');
body = this.req.query.callback + '(' + body + ');';
body = this.req.query.callback.replace(/[^\w$.]/g, '') + '(' + body + ');';
}
}
break;
+9 -2
Ver Arquivo
@@ -14,7 +14,7 @@ var url = require('url')
, connect = require('connect')
, utils = connect.utils
, queryString = require('querystring')
, router = require('connect/middleware/router');
, router = require('connect').router;
/**
* Initialize a new `Server` with optional `middleware`.
@@ -32,7 +32,7 @@ var Server = exports = module.exports = function Server(middleware){
this.viewHelpers = {};
this.dynamicViewHelpers = {};
this.errorHandlers = [];
connect.Server.call(this, middleware || []);
connect.Server.call(this, []);
// Default "home" to /
this.set('home', '/');
@@ -65,6 +65,13 @@ var Server = exports = module.exports = function Server(middleware){
next();
});
// Apply middleware
if (middleware) {
middleware.forEach(function(fn){
self.use(fn);
});
}
// Use router, expose as app.get(), etc
var fn = router(function(app){ self.routes = app; });
this.__defineGetter__('router', function(){
+5 -2
Ver Arquivo
@@ -1,7 +1,7 @@
{
"name": "express",
"description": "Sinatra inspired web development framework",
"version": "1.0.0",
"version": "1.0.5",
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"contributors": [
{ "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" },
@@ -9,7 +9,10 @@
{ "name": "Ciaran Jessup", "email": "ciaranj@gmail.com" },
{ "name": "Guillermo Rauch", "email": "rauchg@gmail.com" }
],
"dependencies": { "connect": ">= 0.3.0" },
"dependencies": {
"connect": ">= 0.5.x",
"qs": ">= 0.0.1"
},
"keywords": ["framework", "sinatra", "web", "rest", "restful"],
"directories": { "lib": "./lib/express" },
"scripts": { "test": "make test" },
Submódulo
+1
Submodule support/qs added at 97a5da1117
+3
Ver Arquivo
@@ -0,0 +1,3 @@
html
!= partial('header', { locals: { title: 'Pets' }})
body!= body
+2
Ver Arquivo
@@ -0,0 +1,2 @@
head
title= title
+1 -1
Ver Arquivo
@@ -114,7 +114,7 @@ module.exports = {
'test #flash()': function(assert){
var app = express.createServer(
connect.cookieDecoder(),
connect.session({ store: memoryStore })
connect.session({ store: memoryStore, secret: 'wahoo' })
);
app.flashFormatters = {
+4
Ver Arquivo
@@ -63,6 +63,10 @@ module.exports = {
{ url: '/jsonp?callback=baz' },
{ body: 'baz({"foo":"bar"});', status: 201, headers: { 'Content-Type': 'text/javascript', 'X-Foo': 'baz' }});
assert.response(app,
{ url: '/jsonp?callback=illegal()[]=;' },
{ body: 'illegal({"foo":"bar"});', status: 201, headers: { 'Content-Type': 'text/javascript', 'X-Foo': 'baz' }});
assert.response(app,
{ url: '/json?callback=test' },
{ body: '{"foo":"bar"}', status: 201, headers: { 'Content-Type': 'application/json', 'X-Foo': 'baz' }});
+26
Ver Arquivo
@@ -563,6 +563,32 @@ module.exports = {
{ body: html });
},
'test #partial() in layout': function(assert){
var app = create();
app.get('/', function(req, res){
res.render('hello.jade', { layout: 'layouts/pets.jade' });
});
assert.response(app,
{ url: '/' },
{ body: '<html><head><title>Pets</title></head><body><p>:(</p></body></html>' });
},
'test #partial() in layout with "view engine" setting': function(assert){
var app = create();
app.set('view engine', 'jade');
app.get('/', function(req, res){
res.render('hello', { layout: 'layouts/pets' });
});
assert.response(app,
{ url: '/' },
{ body: '<html><head><title>Pets</title></head><body><p>:(</p></body></html>' });
},
'test #partial() with array-like collection': function(assert){
var app = create();