Socket
Socket
Sign inDemoInstall

express

Package Overview
Dependencies
18
Maintainers
0
Versions
276
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.1.0

11

History.md
2.1.0 / 2011-03-24
==================
* Added `<root>/_?<name>` partial lookup support. Closes #447
* Added `request`, `response`, and `app` local variables
* Added `settings` local variable, containing the app's settings
* Added `req.flash()` exception if `req.session` is not available
* Added `res.send(bool)` support (json response)
* Fixed stylus example for latest version
* Fixed; wrap try/catch around `res.render()`
2.0.0 / 2011-03-17

@@ -3,0 +14,0 @@ ==================

2

lib/express.js

@@ -30,3 +30,3 @@

exports.version = '2.0.0';
exports.version = '2.1.0';

@@ -33,0 +33,0 @@ /**

@@ -86,2 +86,14 @@

// default locals
this.locals({
settings: this.settings
, app: this
});
// default dynamic locals
this.dynamicHelpers({
request: function(req, res){ return req; }
, response: function(req, res){ return res; }
});
// default development configuration

@@ -88,0 +100,0 @@ this.configure('development', function(){

@@ -143,3 +143,3 @@

// route params like /user/:id
if (this.params.hasOwnProperty(name) && undefined !== this.params[name]) {
if (this.params && this.params.hasOwnProperty(name) && undefined !== this.params[name]) {
return this.params[name];

@@ -194,2 +194,3 @@ }

req.flash = function(type, msg){
if (this.session === undefined) throw Error('req.flash() requires sessions');
var msgs = this.session.flash = this.session.flash || {};

@@ -196,0 +197,0 @@ if (type && msg) {

@@ -70,2 +70,3 @@

break;
case 'boolean':
case 'object':

@@ -351,3 +352,3 @@ if (Buffer.isBuffer(body)) {

var host = req.headers.host
, tls = req.connection.constructor.name == 'CleartextStream';
, tls = req.connection.encrypted;
url = 'http' + (tls ? 's' : '') + '://' + host + url;

@@ -354,0 +355,0 @@ }

@@ -217,2 +217,21 @@

try {
return this._render(view, opts, fn, parent, sub);
} catch (err) {
// callback given
if (fn) {
fn(err);
// unwind to root call
} else if (sub) {
throw err;
// root template, next(err)
} else {
this.req.next(err);
}
}
};
// private render()
res._render = function(view, opts, fn, parent, sub){
var options = {}

@@ -270,3 +289,3 @@ , self = this

// Try _ prefix ex: ./views/_user.jade
// Try _ prefix ex: ./views/_<name>.jade
if (!view.exists) view = new View(orig.prefixPath, options);

@@ -281,5 +300,8 @@

// Try layout relative to the "views" dir
if (!view.exists && options.isLayout) view = new View(orig.rootPath, options);
// Try root ex: <root>/user.jade
if (!view.exists) view = new View(orig.rootPath, options);
// Try root _ prefix ex: <root>/_user.jade
if (!view.exists && partial) view = new View(view.prefixPath, options);
// Does not exist

@@ -320,40 +342,26 @@ if (!view.exists) {

// Attempt render
try {
var engine = view.templateEngine
, template = cacheTemplates
? cache[view.path] || (cache[view.path] = engine.compile(view.contents, options))
: engine.compile(view.contents, options)
, str = template.call(options.scope, options);
var engine = view.templateEngine
, template = cacheTemplates
? cache[view.path] || (cache[view.path] = engine.compile(view.contents, options))
: engine.compile(view.contents, options)
, str = template.call(options.scope, options);
// layout expected
if (layout) {
options.isLayout = true;
options.layout = false;
options.body = str;
this.render(layout, options, fn, view, true);
// partial return
} else if (partial) {
return str;
// render complete, and
// callback given
} else if (fn) {
fn(null, str);
// respond
} else {
this.send(str);
}
} catch (err) {
// callback given
if (fn) {
fn(err);
// unwind to root call
} else if (sub) {
throw err;
// root template, next(err)
} else {
this.req.next(err);
}
// layout expected
if (layout) {
options.isLayout = true;
options.layout = false;
options.body = str;
this.render(layout, options, fn, view, true);
// partial return
} else if (partial) {
return str;
// render complete, and
// callback given
} else if (fn) {
fn(null, str);
// respond
} else {
this.send(str);
}
};
}

@@ -360,0 +368,0 @@ /**

{
"name": "express",
"description": "Sinatra inspired web development framework",
"version": "2.0.0",
"version": "2.1.0",
"author": "TJ Holowaychuk <tj@vision-media.ca>",

@@ -13,3 +13,3 @@ "contributors": [

"dependencies": {
"connect": ">= 1.1.0 < 2.0.0",
"connect": ">= 1.1.1 < 2.0.0",
"mime": ">= 0.0.1",

@@ -16,0 +16,0 @@ "qs": ">= 0.0.6"

@@ -57,3 +57,3 @@

* [express-configure](http://github.com/visionmedia/express-configure) async configuration support
* [express-configure](http://github.com/visionmedia/express-configuration) async configuration support
* [express-messages](http://github.com/visionmedia/express-messages) flash notification rendering helper

@@ -60,0 +60,0 @@ * [express-namespace](http://github.com/visionmedia/express-namespace) namespaced route support

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc