Skip to content

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

Open
emmanuel wants to merge 5 commits intovisionmedia:masterfrom
emmanuel:master
Open

Some small changes to make it easier to 'subclass' and specialize Resource#78
emmanuel wants to merge 5 commits intovisionmedia:masterfrom
emmanuel:master

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