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

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

emmanuel
Copy link

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 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`.
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.

1 participant