| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
- Individual method hook chains now work without prior configuration - Add externalMethods option to control HTTP/transport exposure - methods option now controls which methods receive 'all' hooks - Backwards compatible: externalMethods defaults to methods
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.
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.
|
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 context.message). 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 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.
|
I forgot about the .params() calls |
Sorry, something went wrong.
|
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.
- 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
| Back | FazBrowse Home | New Git URL |
Summary
This PR implements the feature requested in #3457, allowing hooks to run on all service methods while providing fine-grained control over which methods are exposed externally.
Changes
@feathersjs/feathers
Type Declarations (declarations.ts)
Service (service.ts)
Hooks (hooks.ts)
HTTP Transport (http/index.ts)
Tests
Features
1. Individual method hooks work without configuration
methods controls which methods receive all hooks
3. externalMethods controls HTTP exposure
Backwards Compatibility
Related