robfig/revel — pull request #421 by landr0id (2013-12-21 05:35:58+00:00)
Title: Importing module routes under the parent path

Per #282, this pull request adds a `joinedPath string` parameter to the `parseRoutes`, `parseRoutesFile`, and `getModuleRoutes` methods . The reason why I chose to add the parameter instead of making modifications to the route directly at L#217 is because that would require iterating over the array of routes returned from `getModuleRoutes` and also because of the logic for creating a new Route (specifically the `TreePath` field).

Unit tests passed:

$ go test github.com/robfig/revel
ok	github.com/robfig/revel	0.075s

For an application test, clone [feature/module-url-mapping-test](https://github.com/landr0id/revel/tree/feature/module-url-mapping-test) and run the following command: `revel run github.com/robfig/revel/samples/booking`

Visit a bad path, and you should see:

Not Found
No matching route found

These routes have been tried, in this order :

GET /@tests TestRunner.Index
GET /@tests.list TestRunner.List
GET /@tests/public/*filepath Static.ServeModule
GET /@tests/:suite/:test TestRunner.Run
GET / Application.Index
GET /hotels Hotels.Index
GET /hotels/list Hotels.List
GET /hotels/:id Hotels.Show
GET /hotels/:id/booking Hotels.Book
POST /hotels/:id/booking Hotels.ConfirmBooking
POST /bookings/:id/cancel Hotels.CancelBooking
GET /register Application.Register
POST /register Application.SaveUser
GET /settings Hotels.Settings
POST /settings Hotels.SaveSettings
POST /login Application.Login
GET /logout Application.Logout
GET /jobs/@jobs Jobs.Status
GET /public/*filepath Static.Serve
GET /favicon.ico Static.Serve
* /:controller/:action :controller.:action

Emphasis on `GET /jobs/@jobs Jobs.Status`.

I'll also update the routing documentation on the gh-pages branch once this is merged (assuming there are no objections to my implementation).