Some small changes to make it easier to 'subclass' and specialize Resource#78
Open
emmanuel wants to merge 5 commits intovisionmedia:masterfrom
Open
Some small changes to make it easier to 'subclass' and specialize Resource#78emmanuel wants to merge 5 commits intovisionmedia:masterfrom
emmanuel wants to merge 5 commits intovisionmedia:masterfrom
Conversation
added 5 commits
August 30, 2013 13:44
This allows subclasses to override how routes are applied to the parent app. Which is useful if you want to, for example, attach a db connection pooling middleware on specific resources (e.g., custom Resource subclasses), or, say, an authentication middleware.
This is in the spirit of Tell, Don't Ask & command/query separation.
The second half of the test file had an extra leading space on every line. No longer.
Now override `app.resource.constructor` or pass `resourceConstructor` in 3rd arg to `app.resource`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I want to have a variant of
Resourcethat accepts middleware (authenticate&persistencekeys) and validates incoming JSON according to a schema (schemakey), in order to emulate some of the features of Percolator. This was approximately the minimum way I could see how to do that.