Some small changes to make it easier to 'subclass' and specialize Resource #78

Open
wants to merge 5 commits into
from

Conversation

Projects
None yet
1 participant

I want to have a variant of Resource that accepts middleware (authenticate & persistence keys) and validates incoming JSON according to a schema (schema key), in order to emulate some of the features of Percolator. This was approximately the minimum way I could see how to do that.

Emmanuel Gomez added some commits Aug 30, 2013

Emmanuel Gomez Extract route application into a method.
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.
7752dfe
Emmanuel Gomez Extract route remapping into _updateBasePath method.
This is in the spirit of Tell, Don't Ask & command/query separation.
5b0fef6
Emmanuel Gomez Fix resource test indentation.
The second half of the test file had an extra leading space on every
line. No longer.
d70026d
Emmanuel Gomez Allow for configuring which Resource constructor to use.
Now override `app.resource.constructor` or pass `resourceConstructor` in
3rd arg to `app.resource`.
5db5667
Emmanuel Gomez Oops. Unbreak tests. e7d6449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment