1.0.9

Latest release in branch 1
Released 23 Mar 2011 (15 years ago)

SoftwareExpress
Branch1
Initial release1.0.0
16 Nov 2010 (15 years ago)
Latest release1.0.9
23 Mar 2011 (15 years ago)
Minimum
Node.js version
0.1.98
End of support (OSS)Mar 2011 (Ended 15 years, 1 month ago)
Release noteshttps://github.com/expressjs/express/releases/tag/1.0.9
Source codehttps://github.com/expressjs/express/tree/1.0.9
Downloadhttps://github.com/expressjs/express/releases/tag/1.0.9
Express 1 ReleasesView full list

What Is New in Express 1

CategoryChange
Breaking ChangesRoute callbacks no longer receive a params argument; signature is now (req, res, next).
Breaking ChangesEXPRESS_ENV support removed; use NODE_ENV exclusively.
New FeaturesMiddleware can pre-define req.query and you can swap the querystring parser.
New FeaturesAdded helpers: res.cookie(), res.clearCookie(), extended res.redirect() with content-negotiation, and streaming support for res.sendfile().
New FeaturesAdded app.all(), app.register() for template engines, and app.flashFormatters.
ImprovementsMounted apps now inherit settings like view engine from their parent.
ImprovementsView engine handling fixed for directories containing periods.
ImprovementsDynamic helper caching and partial object name inference added for performance.
DeprecationsRemoved "reload views" setting; development env never caches, production always caches.
Bug FixesJSONP callbacks now safe, multiple Set-Cookie headers work, and 204 responses correctly strip bodies.
Bug FixesMiddleware stacked via createServer() now has full access to Express methods.

Why does Express 1 change the route handler signature?

The signature was simplified to (req, res, next) so that all route parameters are accessed uniformly via req.params.

Previously you wrote function(req, res, params, next), which forced a separate params argument. The change removes that redundancy and aligns Express with Connect's middleware pattern.

In practice you only need to update any custom middleware that still expects the old four-argument form. A quick grep for function (req, res, params will surface the places to fix.

Example before:

app.get('/user/:id', function (req, res, params, next) {
  var id = params.id;
  // ...
});

After upgrade:

app.get('/user/:id', function (req, res, next) {
  var id = req.params.id;
  // ...
});

How can I predefine req.query and swap query parsers in Express 1?

You can set req.query in earlier middleware or mount a custom parser with the query parser setting.

This is handy when you need to coerce query values or support a non-standard format like qs.

Example of predefining:

app.use(function (req, res, next) {
  // Force all query values to be numbers when possible
  var raw = req.query;
  req.query = {};
  for (var key in raw) {
    var val = Number(raw[key]);
    req.query[key] = isNaN(val) ? raw[key] : val;
  }
  next();
});

Swapping the parser:

var qs = require('qs');
app.set('query parser', function (str) {
  return qs.parse(str);
});

After this, every request's req.query will be the result of qs.parse, giving you deep object support out of the box.

What new response methods does Express 1 add for cookies, redirects, and file streaming?

Express 1 introduces res.cookie(), res.clearCookie(), richer res.redirect() handling, and streaming support for res.sendfile().

Cookie helpers let you set attributes like maxAge or httpOnly in one call:

res.cookie('session', 'abc123', { maxAge: 900000, httpOnly: true });
res.clearCookie('session');

res.redirect() now respects the request's Accept header, returning text/plain or text/html as appropriate, and includes a human-readable status string in the body.

File streaming is more efficient: you can set a stream threshold and Express will pipe the file instead of buffering it.

app.get('/download', function (req, res) {
  res.sendfile('/path/to/large.zip', { maxAge: 0 });
});

These helpers reduce boilerplate and make common response patterns explicit.

Which view-related settings were fixed or added in Express 1?

Mounted apps now inherit the view engine setting, and the engine works correctly even when the view directory name contains a period.

Partial handling got smarter: Express can infer object names from the partial path, cache view-path lookups, and support array-like collections directly.

Dynamic helpers are now cached, improving render performance for frequently used locals.

Example of using a partial with inferred locals:

<%- partial('forum/post', post) %>

The template receives a post local automatically, and the lookup is cached after the first render.

Common Questions about Express 1

Does upgrading to Express 1 require changing all my route callbacks?
Yes, any handler that still uses the four-argument form must be updated to the three-argument signature.

How do I enable a custom querystring parser?
You set the "query parser" app setting to a function that receives the raw query string and returns an object.

What is the difference between res.redirect() before and after Express 1?
Before it always sent a plain 302 with no body; after it negotiates the response type, includes a status string in the body, and respects Accept headers.

Can I still use EXPRESS_ENV after upgrading?
No, EXPRESS_ENV was removed; use NODE_ENV instead.

How do I set a cookie in Express 1?
You call res.cookie(name, value, options) on the response object.

Releases In Branch 1

VersionRelease date
1.0.923 Mar 2011
(15 years ago)
1.0.016 Nov 2010
(15 years ago)