Closed riccardoperra closed 1 year ago
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders
Latest commit: d6b32e47fc50482657b57e72b75fd4fbebc3f17c
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Deploy preview for codeimage-ui-dev ready!
✅ Preview https://codeimage-ui-pqscs2zvd-riccardoperra.vercel.app https://codeimage-ui-pr-485.vercel.app
Built with commit d6b32e47fc50482657b57e72b75fd4fbebc3f17c. This pull request is being automatically deployed with vercel-action
Deploy preview for codeimage-highlight-dev ready!
✅ Preview https://codeimage-highlight-g8f8s7b6w-riccardoperra.vercel.app https://codeimage-highlight-pr-485.vercel.app
Built with commit d6b32e47fc50482657b57e72b75fd4fbebc3f17c. This pull request is being automatically deployed with vercel-action
Deploy preview for codeimage ready!
✅ Preview https://codeimage-84dqfflr5-riccardoperra.vercel.app https://codeimage-app-pr-485.vercel.app
Built with commit d6b32e47fc50482657b57e72b75fd4fbebc3f17c. This pull request is being automatically deployed with vercel-action
Deploy preview for codeimage-website-dev ready!
✅ Preview https://codeimage-website-2z5slz8nm-riccardoperra.vercel.app https://codeimage-website-pr-485.vercel.app
Built with commit d6b32e47fc50482657b57e72b75fd4fbebc3f17c. This pull request is being automatically deployed with vercel-action
Handlers
Handlers are domain scoped functions that can be used to extract business logic and make it independent by the rest of the application.
They are registered into a global registry map
HandlerRegistry
which exposes anadd
method to register a new handler, and aevent
property to retrieve the registered handlersCreating new handlers
Handlers can be created through the
HandlerBuilder
which use the builder pattern under the hood. In order to create the handler correctly you must define the dependencies, the handler name and it's implementation.Registering handlers
Once you have created your handlers, you can register all of them through the
registerHandlers
helper, which accept a list of handlers, the requested dependencies and the registryHandlers can be used from both
handlers
orregistry
mapUsing in Fastify