Commit Graph

197 Commits

Author SHA1 Message Date
Douglas Christopher Wilson
3e32721e24 Fix subapp.mountpath regression for app.use(subapp)
fixes #2233
2014-07-12 22:07:43 -04:00
Douglas Christopher Wilson
997a558a73 Accept multiple callbacks to app.use()
fixes #2224
2014-07-11 17:13:06 -04:00
Douglas Christopher Wilson
1c3bd36be6 Support non-string path in app.use(path, fn)
fixes #2207
2014-07-11 16:35:37 -04:00
Douglas Christopher Wilson
185e327e29 add deprecation message to app.configure 2014-07-03 14:13:39 -04:00
Douglas Christopher Wilson
bdfd288eec fix behavior when handling request without routes
fixes #2159
2014-06-22 12:02:32 -04:00
Douglas Christopher Wilson
7e01531e50 use finalhandler for final response handling 2014-06-22 12:01:55 -04:00
Douglas Christopher Wilson
3ffceff3ed Merge tag '3.12.0' 2014-06-22 11:42:15 -04:00
Douglas Christopher Wilson
9c731f1883 deprecate things with depd module 2014-06-19 23:34:58 -04:00
Nick Heiner
253ce4837a Use path.resolve for views dir instead of concat
closes #2165
2014-06-08 17:41:36 -04:00
Douglas Christopher Wilson
9e6b881f85 remove jsdoc params for polymorphic functions
until jsdoc has a way to actually document them

closes #2156
2014-06-02 10:26:15 -04:00
Douglas Christopher Wilson
db4448dda8 Merge tag '3.9.0' 2014-05-30 22:17:51 -04:00
Douglas Christopher Wilson
c21226aa7c improve etag control for res.send
closes #1435
closes #2129
2014-05-30 21:02:21 -04:00
Douglas Christopher Wilson
7f049164b7 Revert "fix behavior of multiple app.VERB for the same path"
This reverts commit 31b2e2d7b4.

fixes #2133
2014-05-23 18:35:20 -04:00
Douglas Christopher Wilson
097cd0c242 Merge tag '3.7.0' 2014-05-18 11:21:30 -04:00
Douglas Christopher Wilson
566720be15 improve proxy trust with ip address list
closes #2099
2014-05-17 20:02:20 -04:00
Douglas Christopher Wilson
31b2e2d7b4 fix behavior of multiple app.VERB for the same path
fixes #2116
2014-05-16 15:09:42 -04:00
Douglas Christopher Wilson
35c50601bd Merge tag '3.6.0' 2014-05-09 17:33:26 -04:00
Douglas Christopher Wilson
0461e55380 deprecate app.del
closes #2095
2014-05-08 19:16:25 -04:00
Roman Shtylman
6f9e927633 remove deprecation message about passing path as array
backport commit 6b19e3dc0a
2014-05-08 18:09:25 -04:00
Oliver Salzburg
40a43eb753 Value parameter of app.set() is now typed optional mixed 2014-05-08 17:04:14 -04:00
agchou
13475977af some code cleanup 2014-03-25 15:23:04 -07:00
Roman Shtylman
1eba854f23 support arrays as middleware arguments to .VERB and .all
Express 3.x supported passing in arrays for sets of common middleware.
While there are better ways to do this, removing this feature causes
headache in upgrading for no real gain. We can support it without much
more code.
2014-03-23 21:29:59 -04:00
Roman Shtylman
6b19e3dc0a remove deprecation message about passing path as array 2014-03-23 21:07:37 -04:00
Roman Shtylman
0719e5f402 implement app.route() 2014-02-23 11:31:43 -05:00
Roman Shtylman
6835289564 remove ServerResonse.headerSent monkey patch
node.js ServerResponse contains a headersSent field. Use that instead of
our patched misnamed version.
2014-02-22 09:26:29 -05:00
Roman Shtylman
1396e0855d remove last pieces of connect dependency
- copy over patch.js to shim ServerResponse
- bundle `static` middleware
2014-02-22 09:26:29 -05:00
Roman Shtylman
9bc63d92a0 move connect.query() into our repo 2014-02-22 09:26:29 -05:00
Roman Shtylman
f41d09a3cf remove app.router and refactor middleware processing
This is an overhaul of middleware processing, Router and Route. Connect is no
longer used to process the middleware stack. This functionality has been
split into two parts: middleware stack and default error response.

The entry point for request processing is the `app.handle` method. It
sets up the default error response handle (to run in the event of no
other error handler) and then triggers the app router (instance of
Router) to handle the request.

The app router `handle` function contains the middleware dispatch layer
previously in the connect codebase. This layer handle the logic for
dispatching `.use` calls (stripping paths if needed). The app contains a
base router `app._router`. New routes can be created and `.use`d on this
router to organize routes into files.

Routers now have the following methods `.use`, `.all`, `.param` which
are all public.

Additionally, Routers have a `.route(path)` method which returns a new
instance of Route for the requested path. Route(s) are isolated
middleware stacks and contain methods for the HTTP verbs as well as an
`.all` method to act similar to middleware. These methods are chainable
to easily describe requirements for a route.

  var route = Router.route('/foo'); // or 'app.route('/foo')'

  route
  .all(auth)
  .get(function(...) {})
  .all(more_checks)
  .post(function(...) {})

Any Route and Router methods which accept handlers also accept error
(arity 4) handlers which will also behave as expected.

Finally, the `app.router` getter has been removed. Middleware and
handlers are run IN THE ORDER they are seen in the file. This means that
code which injected the `app.router` and then added error handlers (or
other middleware) will need to be updated to move those handlers after
any requests added on the app object. The examples have been updated
accordingly. This is the largest breaking change to codebases in this
commit.
2014-02-03 15:59:52 -05:00
Roman Shtylman
4983c38298 change res.locals to a plain js object.
Anyone who wants something fancier should use modules.

- fixes annoyance with not being able to set 'name' property on locals
2014-01-27 19:17:29 -05:00
Roman Shtylman
337ab24899 remove unused require 2014-01-24 19:31:32 -05:00
Roman Shtylman
718e68ffae use utils-merge module to mixin object properties 2014-01-24 19:16:37 -05:00
Haoliang Gao
fd6439bb36 delete semicolon 2014-01-19 23:53:48 +08:00
Roman Shtylman
7282b50ad0 remove app.configure() 2014-01-11 10:53:54 -05:00
Roman Shtylman
8c059469fd No 'json spaces' by default
Json rendering can be handled by user tools or overridden in their own
app to behave as desired. Minimizes the use of magic env settings.
2014-01-11 10:53:36 -05:00
Roman Shtylman
8c3f153dd4 remove use of app.configure for view cache setting 2014-01-11 10:52:38 -05:00
Oliver Salzburg
28af21baeb Value parameter of app.set() is now typed optional mixed 2014-01-04 22:05:19 +01:00
Oliver Salzburg
951c70496b Value parameter of app.set() should be typed optional Object 2014-01-04 17:50:27 +01:00
Matt Copperwaite
85834fd146 Error message now describes where the view was not able to be found. Useful for debugging. 2013-12-20 11:39:31 +00:00
Jonathan Ong
9bed2b80ee lint: remove unused stuff 2013-10-18 01:18:56 -07:00
Jake Seip
ed7db34bab documentation language fix 2013-09-19 10:41:45 -07:00
TJ Holowaychuk
5aa9670120 Merge pull request #1685 from CharlesHolbrow/master
Fix typo in app.param comment
2013-08-02 14:46:40 -07:00
Max Riveiro
54a192a5c5 Add application setting to disable ETag completely 2013-07-21 12:49:28 +04:00
Charles Holbrow
3de81e0147 Fix typo in app.param comment 2013-07-13 16:32:02 -07:00
Max Melentiev
a3c9eacaf1 move .app to req's & res's prototypes 2013-06-11 19:42:30 +04:00
TJ Holowaychuk
91c71d6c2e add app.VERB() paths array deprecation warning 2013-04-15 15:18:28 -07:00
Caridy Patino
0b4e2df480 add "view" constructor setting to override view behaviour 2013-04-13 09:53:50 -07:00
TJ Holowaychuk
82731dae6e Merge pull request #1503 from shesek/settings-inheritance
Inherit settings from parent application using [[Prototype]]
2013-04-01 14:29:20 -07:00
TJ Holowaychuk
9df93d6dec Merge pull request #1533 from shesek/old-viewcallbacks
Removed old references to viewCallbacks
2013-03-06 14:31:45 -08:00
Nadav Ivgi
1e251af8d3 Removed old references to viewCallbacks
Was part of the deprecated locals.use() functionallity
2013-03-07 00:12:50 +02:00
Alexey Kucherenko
46536dee39 fixed typo 2013-02-22 15:52:42 +04:00
TJ Holowaychuk
89427228d1 typo 2013-02-08 08:42:47 -08:00
Nadav Ivgi
420225f370 inherit settings from parent application using [[Prototype]] 2013-02-08 12:58:07 +02:00
TJ Holowaychuk
cd54faa4af move "subdomain offset" defaulting to config 2013-01-23 20:10:29 -08:00
TJ Holowaychuk
8beb1f21ef change prev commit to use app.enabled() 2013-01-18 14:38:50 -08:00
Roman Shtylman
e4907ce8e8 add http verbs methods to Router
By having the method verbs available on the router, users can set up
disjoint routers and organized paths easier.

It is now possible to have a .js file export the router.middleware and
attach these paths using an `app.use('/path', middleware)` call. This
means that any routes written in the separate file do not need to have a
full path hardcoded as they can be mounted by the application anywhere.

This is already possible using `router.route(verb, args)` however is
needlessly verbose without this patch.
2012-12-25 16:43:56 -05:00
TJ Holowaychuk
9bd86cdddc Revert "add 'etag' option"
This reverts commit 6f6eec7d8d.
2012-12-06 15:15:49 -08:00
Max Riveiro
6f6eec7d8d add 'etag' option 2012-12-05 16:49:09 -08:00
Vitaly
534fbdb307 delete unused variables 2012-11-08 17:07:08 +04:00
TJ Holowaychuk
2d49c0d1f3 Merge branch 'master' of github.com:visionmedia/express 2012-11-04 12:28:53 -08:00
TJ Holowaychuk
a7ca3817db fix route chaining regression. Closes #1397 2012-11-04 12:28:35 -08:00
Roman Shtylman
dadf57cc8b remove unused variables
Tests and examples with unused variables are unchanged.
2012-10-27 16:04:00 -04:00
TJ Holowaychuk
76d3ec583d move default of "views" out so multiple cwd() calls are not made 2012-10-06 09:58:17 -07:00
TJ Holowaychuk
363d0d4f41 Merge branch 'master' of github.com:visionmedia/express 2012-09-13 09:52:46 -07:00
TJ Holowaychuk
5ac631a270 add "x-powered-by" setting 2012-09-13 09:52:35 -07:00
Nicholas Kinsey
d7cb213eeb Update lib/application.js
typo: http -> https
2012-09-05 05:20:37 +10:00
TJ Holowaychuk
f2d7bbe0e9 change jsonp callback default to false. Closes #1304 2012-08-28 09:08:41 -07:00
TJ Holowaychuk
6bebe0837f refactor res.render() to prevent clobbering "locals" 2012-08-11 15:04:54 -07:00
TJ Holowaychuk
26eeb64640 add err.view property for view errors. Closes #1226 2012-07-11 08:45:37 -07:00
riadh
5426eb0b62 add "jsonp callback name" setting 2012-07-06 08:53:31 -07:00
TJ Holowaychuk
4f7c4d1051 remove app.locals.use and res.locals.use
there are a few reasons for this:

  a) less API, simpler implementation ...
  b) difficult to inherit cleanly from subapps
  c) effectively the same as parallelized middleware (use connect-parallel for example)

lastly this api in a sense promotes some obscure uses since
they may be scattered throughout rather than explicitly
given to specific routes or used globally as middleware etc
2012-07-05 18:46:19 -07:00
TJ Holowaychuk
78845e7d23 fix app.locals.use() when mounting apps 2012-07-05 18:31:02 -07:00
TJ Holowaychuk
170dcc2907 Added "methods" dep 2012-06-26 11:38:55 -07:00
Pavel Lang
6556cefc71 Refactoring: no need for add 'del' and 'all' to methods 2012-06-18 04:55:25 +03:00
TJ Holowaychuk
d9aea70ccc removed file heading comments 2012-05-03 08:43:42 -07:00
TJ Holowaychuk
dd33ef2eb6 Added res.locals.use(). Closes #1120 2012-05-03 08:42:18 -07:00
TJ Holowaychuk
18cdb3d845 Added public app.routes. Closes #887
keep things simple for now :)
2012-05-02 16:19:41 -07:00
TJ Holowaychuk
441b309959 Fixed req/res proto inheritance 2012-04-26 04:38:33 -07:00
TJ Holowaychuk
d0bc0ad2ca Added new mvc example 2012-04-26 03:53:49 -07:00
TJ Holowaychuk
58d522d824 restore req/res proto 2012-04-26 03:22:44 -07:00
TJ Holowaychuk
a376980a69 update headers 2012-04-25 21:49:43 -07:00
TJ Holowaychuk
18a6bbfd80 docs 2012-04-25 17:59:02 -07:00
TJ Holowaychuk
fab3e91973 app.engine() docs 2012-04-18 17:23:54 -07:00
TJ Holowaychuk
b4cd6bb8f0 removed old route reflection methods 2012-04-15 21:01:33 -07:00
TJ Holowaychuk
7e81cad0bf Added new dox API docs 2012-04-15 21:01:17 -07:00
TJ Holowaychuk
089a83363f Changed: enable "jsonp callback" as a default 2012-04-15 11:20:25 -07:00
TJ Holowaychuk
67ca22b6e4 throw when callback is not given to app.engine() 2012-04-04 12:30:25 -07:00
TJ Holowaychuk
18fa2c9c7d removed debug() for .use()
connect does this now
2012-04-02 15:54:19 -07:00
TJ Holowaychuk
04d43d60b7 added nicer error messages for failed view lookup. Closes #1065 2012-04-02 15:47:10 -07:00
TJ Holowaychuk
d115798d5b ocd 2012-02-23 21:34:48 -08:00
TJ Holowaychuk
e2f43df5e9 refactored app.render() 2012-02-22 09:04:59 -08:00
Tj Holowaychuk
6518e746c1 removed require "qs" as its no longer used. Closes #1014 2012-02-16 08:17:59 -08:00
Tj Holowaychuk
2a40571118 Added DEBUG=express:application support 2012-02-09 13:29:21 -08:00
TJ Holowaychuk
ff92afa557 Added "json replacer" and "json spaces" settings. Closes #996 [credit to jed] 2012-02-07 03:30:34 -08:00
Tj Holowaychuk
c3c0fb95a8 backported fix from 2.x for app.all() del method 2012-02-06 10:12:59 -08:00
Peter Rekdal Sunde
fa51cb8d63 Typo 2012-01-19 02:14:30 +01:00
TJ Holowaychuk
edfe50e713 Removed app.is() support 2011-12-30 15:10:51 -08:00
TJ Holowaychuk
144a88b109 Removed app.match() 2011-12-28 12:09:58 -07:00
TJ Holowaychuk
6dac874ff4 renamed Router#_route() -> route() 2011-12-28 11:55:11 -07:00
TJ Holowaychuk
c0c1975da6 decouple Router options. Closes #941 2011-12-28 11:14:57 -07:00
Tj Holowaychuk
7d24c2ba40 Fixed app.set() with undefined 2011-12-15 09:00:39 -08:00