GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||
GeezerVison is showing github.com — feat: Allow hooks on all methods and add externalMethods option (#3457) by marshallswain · Pull Request #3638 · feathersjs/feathers Conversation
|
Deploying feathers-eagle with
|
| Latest commit: |
09bb238
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2c692814.feathers-a8l.pages.dev |
| Branch Preview URL: | https://v6-hooks-all-methods.feathers-a8l.pages.dev |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Deploying feathers-dove with
|
| Latest commit: |
09bb238
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://09e7e607.feathers.pages.dev |
| Branch Preview URL: | https://v6-hooks-all-methods.feathers.pages.dev |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
9d59599 to
da29174
Compare
|
I'm wondering if we need to add a new API if we are promoting using decorators going forward. For internal methods you need to list the parameter names of the method anyway to make it useful (to have things like This already works and lets you register hooks on any method: import { hooks } from 'feathers' class MyService { @hooks([]).params('message') internalMethod(message: string) {} @hooks([]) find() { } } |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
There are still use cases where decorators will not work well, like when using built-in services from a database manager instance. It's a bit verbose to do custom adapter classes just to be able to add hooks. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I forgot about the .params() calls |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Wouldn't that work with the object wrapper? import { hooks } from 'feathers' import { MemoryService } from 'feathers-memory' const messageService = hooks(new MemoryService(), { myMethod: middleware([]).params('message') }) app.use('messages', messageService) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
- Add @method decorator for configuring custom service methods - Support different argument signatures (not just data, params) - Support different HTTP verbs (GET, POST, PUT, PATCH, DELETE) - Support clean URL paths (e.g., /messages/:id/status) - Support internal-only methods with external: false - Add buildMethodConfig() helper for client configuration - Add InferServiceTypes type helper for typed clients - Update REST client to support custom method paths and verbs - Update services and REST client documentation The @method decorator allows custom methods to be first-class citizens with flexible signatures, proper HTTP verb mapping, and clean URLs instead of relying on X-Service-Method headers. Closes #1976 Replaces #3638
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.