Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested Routes #40

Merged
merged 9 commits into from
Feb 21, 2016
Merged

Nested Routes #40

merged 9 commits into from
Feb 21, 2016

Conversation

mpclarkson
Copy link
Contributor

Ok, this is now working on Ubuntu (via docker) and I have added tests for simple (single) and nests resources.

I also simplified the path construction by removing the Zip2Sequence which was unnecessarily verbose:

let fullPath = components.enumerate()
    .map { $1 + "/" + params[$0] }
    .joinWithSeparator("/")

@tanner0101
Copy link
Member

This looks good. I will try it out and merge when I'm back on my computer.

@mpclarkson
Copy link
Contributor Author

Just discussing with @loganwright on Slack... Currently all parameters are named for nested resources i.e. /user/:user_id/company/:company_id but he has suggested always keeping the final resource unnamed i.e. /user/:user_id/company/:id, so the final parameter is always :id irrespective or whether it is a single or nested resource. This makes sense to me so I'll update the pr.

@@ -247,11 +247,33 @@ Here the `HeartbeatControllers`'s index method will be called when `http://examp

Resource controllers take advantage of CRUD-like `index`, `show`, `store`, `update`, `destroy` methods to make setting up REST APIs easy.

*Single Resources*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use ###

@tanner0101
Copy link
Member

Looks great. Just a few comments.

@mpclarkson
Copy link
Contributor Author

Done.

@tanner0101
Copy link
Member

Great, thank you!

tanner0101 added a commit that referenced this pull request Feb 21, 2016
@tanner0101 tanner0101 merged commit c44ead8 into vapor:master Feb 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants