Skip to content

Hooks vs. Decorators #606

@wscherphof

Description

@wscherphof

💬 Question here

I can decorate requests using fastify.decorateRequest.
I can also create an onRequest hook and extend the request object there.

What are the fundamental differences between the two approaches?

Your Environment

  • node version: 16
  • fastify version: 3
  • os: Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions