This module provides middleware for mounting other applications on a specific URI path or virtual host.
Applying this middleware adds a
mount method to the application. The mount
method takes a path or virtual host specification and an application as arguments.
If the spec is a string, it is interpreted as the URI path on which the app will be
mounted. If it is an object, it may contain
that will be matched against the URI path and
Host header of incoming requests.
Note that virtual host based mounting has not been tested so far.
mount method accepts an optional third boolean
If set to
true it will disable redirecting GET requests to the mount base
URL without a trailing slash to the same URL with trailing slash. By default,
mount middleware will send a redirect to the mount URL with trailing slash.
Mounting one application within another causes the
properties in the request object to be adjusted so that the mounted application
receives the same pathInfo as if it was the main application. This means
that forward and reverse request routing will usually work as expected.
This middleware maintains an index mapping applications to mount points which can be accessed using the lookup function. The [stick/helpers][helpers] module provides higher level functions for this which include support for the route middleware.
app.configure("mount"); app.mount("/wiki", module.resolve("vendor/ringowiki"));
Return the URI path of a mounted application
a mounted JSGI application
the URI path of the application, or ""
middleware (next, app)
Middleware to mount other application on specific URI paths or virtual hosts.
the wrapped middleware chain
the Stick Application object
a JSGI middleware function