mirror of
https://github.com/expressjs/express.git
synced 2026-02-28 03:29:26 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92c1c953dc | ||
|
|
8b372b3faa | ||
|
|
da3a743c1b | ||
|
|
09c9537381 | ||
|
|
9cf1800731 | ||
|
|
0d0fd347ab | ||
|
|
5cf8023dc3 | ||
|
|
380a6c5363 | ||
|
|
c047b64ab5 | ||
|
|
ae2bcb2615 | ||
|
|
02cdf0c72b |
10
History.md
10
History.md
@@ -1,4 +1,14 @@
|
||||
|
||||
2.5.3 / 2011-12-30
|
||||
==================
|
||||
|
||||
* Fixed `req.is()` when a charset is present
|
||||
|
||||
2.5.2 / 2011-12-10
|
||||
==================
|
||||
|
||||
* Fixed: express(1) LF -> CRLF for windows
|
||||
|
||||
2.5.1 / 2011-11-17
|
||||
==================
|
||||
|
||||
|
||||
70
bin/express
70
bin/express
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
var fs = require('fs')
|
||||
, os = require('os')
|
||||
, exec = require('child_process').exec
|
||||
, mkdirp = require('mkdirp');
|
||||
|
||||
@@ -12,7 +13,7 @@ var fs = require('fs')
|
||||
* Framework version.
|
||||
*/
|
||||
|
||||
var version = '2.5.0';
|
||||
var version = '2.5.2';
|
||||
|
||||
/**
|
||||
* Add session support.
|
||||
@@ -26,6 +27,12 @@ var sessions = false;
|
||||
|
||||
var cssEngine;
|
||||
|
||||
/**
|
||||
* End-of-line code.
|
||||
*/
|
||||
|
||||
var eol = 'win32' == os.platform() ? '\r\n' : '\n';
|
||||
|
||||
/**
|
||||
* Template engine to utilize.
|
||||
*/
|
||||
@@ -43,7 +50,7 @@ var usage = ''
|
||||
+ ' Options:\n'
|
||||
+ ' -s, --sessions add session support\n'
|
||||
+ ' -t, --template <engine> add template <engine> support (jade|ejs). default=jade\n'
|
||||
+ ' -c, --css <engine> add stylesheet <engine> support (less|stylus). default=plain css\n'
|
||||
+ ' -c, --css <engine> add stylesheet <engine> support (stylus). default=plain css\n'
|
||||
+ ' -v, --version output framework version\n'
|
||||
+ ' -h, --help output help information\n'
|
||||
;
|
||||
@@ -61,7 +68,7 @@ var index = [
|
||||
, 'exports.index = function(req, res){'
|
||||
, ' res.render(\'index\', { title: \'Express\' })'
|
||||
, '};'
|
||||
].join('\n');
|
||||
].join(eol);
|
||||
|
||||
/**
|
||||
* Jade layout template.
|
||||
@@ -74,7 +81,7 @@ var jadeLayout = [
|
||||
, ' title= title'
|
||||
, ' link(rel=\'stylesheet\', href=\'/stylesheets/style.css\')'
|
||||
, ' body!= body'
|
||||
].join('\n');
|
||||
].join(eol);
|
||||
|
||||
/**
|
||||
* Jade index template.
|
||||
@@ -83,7 +90,7 @@ var jadeLayout = [
|
||||
var jadeIndex = [
|
||||
'h1= title'
|
||||
, 'p Welcome to #{title}'
|
||||
].join('\n');
|
||||
].join(eol);
|
||||
|
||||
/**
|
||||
* EJS layout template.
|
||||
@@ -100,7 +107,7 @@ var ejsLayout = [
|
||||
, ' <%- body %>'
|
||||
, ' </body>'
|
||||
, '</html>'
|
||||
].join('\n');
|
||||
].join(eol);
|
||||
|
||||
/**
|
||||
* EJS index template.
|
||||
@@ -109,7 +116,7 @@ var ejsLayout = [
|
||||
var ejsIndex = [
|
||||
'<h1><%= title %></h1>'
|
||||
, '<p>Welcome to <%= title %></p>'
|
||||
].join('\n');
|
||||
].join(eol);
|
||||
|
||||
/**
|
||||
* Default css template.
|
||||
@@ -124,22 +131,7 @@ var css = [
|
||||
, 'a {'
|
||||
, ' color: #00B7FF;'
|
||||
, '}'
|
||||
].join('\n');
|
||||
|
||||
/**
|
||||
* Default less template.
|
||||
*/
|
||||
|
||||
var less = [
|
||||
'body {'
|
||||
, ' padding: 50px;'
|
||||
, ' font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;'
|
||||
, '}'
|
||||
, ''
|
||||
, 'a {'
|
||||
, ' color: #00B7FF;'
|
||||
, '}'
|
||||
].join('\n');
|
||||
].join(eol);
|
||||
|
||||
/**
|
||||
* Default stylus template.
|
||||
@@ -151,7 +143,7 @@ var stylus = [
|
||||
, ' font: 14px "Lucida Grande", Helvetica, Arial, sans-serif'
|
||||
, 'a'
|
||||
, ' color: #00B7FF'
|
||||
].join('\n');
|
||||
].join(eol);
|
||||
|
||||
/**
|
||||
* App template.
|
||||
@@ -194,7 +186,7 @@ var app = [
|
||||
, 'app.listen(3000);'
|
||||
, 'console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);'
|
||||
, ''
|
||||
].join('\n');
|
||||
].join(eol);
|
||||
|
||||
// Parse arguments
|
||||
|
||||
@@ -277,9 +269,6 @@ function createApplicationAt(path) {
|
||||
case 'stylus':
|
||||
write(path + '/public/stylesheets/style.styl', stylus);
|
||||
break;
|
||||
case 'less':
|
||||
write(path + '/public/stylesheets/style.less', less);
|
||||
break;
|
||||
default:
|
||||
write(path + '/public/stylesheets/style.css', css);
|
||||
}
|
||||
@@ -304,11 +293,8 @@ function createApplicationAt(path) {
|
||||
|
||||
// CSS Engine support
|
||||
switch (cssEngine) {
|
||||
case 'less':
|
||||
app = app.replace('{css}', '\n app.use(express.compiler({ src: __dirname + \'/public\', enable: [\'' + cssEngine + '\'] }));');
|
||||
break;
|
||||
case 'stylus':
|
||||
app = app.replace('{css}', '\n app.use(require(\'stylus\').middleware({ src: __dirname + \'/public\' }));');
|
||||
app = app.replace('{css}', eol + ' app.use(require(\'stylus\').middleware({ src: __dirname + \'/public\' }));');
|
||||
break;
|
||||
default:
|
||||
app = app.replace('{css}', '');
|
||||
@@ -316,22 +302,22 @@ function createApplicationAt(path) {
|
||||
|
||||
// Session support
|
||||
app = app.replace('{sess}', sessions
|
||||
? '\n app.use(express.cookieParser());\n app.use(express.session({ secret: \'your secret here\' }));'
|
||||
? eol + ' app.use(express.cookieParser());' + eol + ' app.use(express.session({ secret: \'your secret here\' }));'
|
||||
: '');
|
||||
|
||||
// Template support
|
||||
app = app.replace(':TEMPLATE', templateEngine);
|
||||
|
||||
// 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';
|
||||
var json = '{' + eol;
|
||||
json += ' "name": "application-name"' + eol;
|
||||
json += ' , "version": "0.0.1"' + eol;
|
||||
json += ' , "private": true' + eol;
|
||||
json += ' , "dependencies": {' + eol;
|
||||
json += ' "express": "' + version + '"' + eol;
|
||||
if (cssEngine) json += ' , "' + cssEngine + '": ">= 0.0.1"' + eol;
|
||||
if (templateEngine) json += ' , "' + templateEngine + '": ">= 0.0.1"' + eol;
|
||||
json += ' }' + eol;
|
||||
json += '}';
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ var exports = module.exports = connect.middleware;
|
||||
* Framework version.
|
||||
*/
|
||||
|
||||
exports.version = '2.5.1';
|
||||
exports.version = '2.5.3';
|
||||
|
||||
/**
|
||||
* Shortcut for `new Server(...)`.
|
||||
|
||||
@@ -292,16 +292,18 @@ req.flash = function(type, msg){
|
||||
req.is = function(type){
|
||||
var fn = this.app.is(type);
|
||||
if (fn) return fn(this);
|
||||
var contentType = this.headers['content-type'];
|
||||
if (!contentType) return;
|
||||
var ct = this.headers['content-type'];
|
||||
if (!ct) return false;
|
||||
ct = ct.split(';')[0];
|
||||
if (!~type.indexOf('/')) type = mime.lookup(type);
|
||||
if (~type.indexOf('*')) {
|
||||
type = type.split('/')
|
||||
contentType = contentType.split('/');
|
||||
if ('*' == type[0] && type[1] == contentType[1]) return true;
|
||||
if ('*' == type[1] && type[0] == contentType[0]) return true;
|
||||
type = type.split('/');
|
||||
ct = ct.split('/');
|
||||
if ('*' == type[0] && type[1] == ct[1]) return true;
|
||||
if ('*' == type[1] && type[0] == ct[0]) return true;
|
||||
return false;
|
||||
}
|
||||
return !! ~contentType.indexOf(type);
|
||||
return !! ~ct.indexOf(type);
|
||||
};
|
||||
|
||||
// Callback for isXMLHttpRequest / xhr
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "express",
|
||||
"description": "Sinatra inspired web development framework",
|
||||
"version": "2.5.1",
|
||||
"version": "2.5.3",
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"contributors": [
|
||||
{ "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" },
|
||||
@@ -10,7 +10,7 @@
|
||||
{ "name": "Guillermo Rauch", "email": "rauchg@gmail.com" }
|
||||
],
|
||||
"dependencies": {
|
||||
"connect": "1.8.x",
|
||||
"connect": "1.x",
|
||||
"mime": ">= 0.0.1",
|
||||
"qs": ">= 0.3.1",
|
||||
"mkdirp": "0.0.7"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var express = require('express')
|
||||
var express = require('../')
|
||||
, connect = require('connect')
|
||||
, assert = require('assert')
|
||||
, should = require('should')
|
||||
|
||||
Reference in New Issue
Block a user