Giter Club home page Giter Club logo

Comments (7)

johaven avatar johaven commented on June 10, 2024 3

I think that creating the verb helpers could be done inside Nest if you really need them.

This is probably the best solution in the meantime.

In my view, Nest's Fastify adapter should call methods from fastify.route rather than from the instance to ensure that the call is made on a method rather than a user decorator.

If there are no other comments I will close this discussion.

from fastify.

gurgunday avatar gurgunday commented on June 10, 2024

Moving my comment here:

Per @climba03003's comment: #4409 (review)

Backporting these shorthands could conflict with decorated properties of current users, making this breaking

from fastify.

johaven avatar johaven commented on June 10, 2024

Is there currently a system to prevent http methods from being used as decorators?

We could implement a way to warn the user that he will not be able to use a method name as a decorator in the next version.

In the current version we could check the name of the decorator used, display a warning and prioritize the execution of the user decorator rather than the method to avoid any break.

Just an idea :)

Even if V5 was released tomorrow, I think the NestJs team will take some time before integrating this version into their framework.
I'm just trying to find a solution to prevent the community from waiting a few more years just for some rather standard methods (which are very useful to us in our tools and applications).

from fastify.

gurgunday avatar gurgunday commented on June 10, 2024

Is there currently a system to prevent http methods from being used as decorators?

It just throws, as an example you can try: fastify.decorate('head', () => {}), it should throw

I'm just trying to find a solution to prevent the community from waiting a few more years

I (and others) really want v5 to be released as soon as possible and we will be pushing for it, right now I just know that most maintainers are busy as node 22 (next LTS) is about to be released, so there is focus on getting as much stuff in it as possible

How about making decorated webdav methods an option (turned off by default in v4)

I would fully support that actually

from fastify.

climba03003 avatar climba03003 commented on June 10, 2024

You are not block from using those methods by fastify.route.
It is not necessary for the shorthands method exist before using.

from fastify.

mcollina avatar mcollina commented on June 10, 2024

I think that creating the verb helpers could be done inside Nest if you really need them.

Generically this is not needed, because you can always use .route(). If you can't, it's on Nest.

from fastify.

johaven avatar johaven commented on June 10, 2024

Indeed the problem is that Nest uses the instance followed by the method to handle the requests in their adapter: https://github.com/nestjs/nest/blob/727032e46e2371a934a1a99ec42634fabd271738/packages/platform-fastify/adapters/fastify-adapter.ts#L705

from fastify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.