Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed mounting Derby app to an Express app using route other then '/' #11

Open
wants to merge 1 commit into from

1 participant

@irnc

Without this fix routing will work only on server side, because request
would be handled by Express first before passing it to tracks router.

Client side routing will fail because tracks router will receive
prefixed URL for handling, e.g. it will receive '/derby-app/home' while
knowing only about '/home' route.

@irnc irnc Fixed mounting Derby app to an Express app using route other then '/'
Without this fix routing will work only on server side, because request
would be handled by Express first before passing it to `tracks` router.

Client side routing will fail because `tracks` router will receive
prefixed URL for handling, e.g. it will receive '/derby-app/home' while
knowing only about '/home' route.
16fbaf5
@irnc

Rebased patch branch over current master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 3, 2013
  1. @irnc

    Fixed mounting Derby app to an Express app using route other then '/'

    irnc authored
    Without this fix routing will work only on server side, because request
    would be handled by Express first before passing it to `tracks` router.
    
    Client side routing will fail because `tracks` router will receive
    prefixed URL for handling, e.g. it will receive '/derby-app/home' while
    knowing only about '/home' route.
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/browser.js
View
9 lib/browser.js
@@ -61,6 +61,15 @@ function setup(app, createPage, onRoute) {
return app
}
+ /*
+ * Mounting Derby app to an Express app using route other then '/'
+ * requires specification of an `app.mountPoint` so Derby application
+ * routes can be matched correctly on the client side.
+ *
+ * expressApp.use(derbyApp.mountPoint = '/derby-app', derbyApp.router())
+ */
+ pattern = (app.mountPoint || '') + pattern
+
queue.push(new Route(method, pattern, callback))
return app
}
Something went wrong with that request. Please try again.