#How can I get full path of the method while using method decorator? `target` is {}

2 messages · Page 1 of 1 (latest)

tough nova
#

I am creating my custom decorator to simplify usage with dapr pubsub, but in the end this is not important.

I have custom method decorator which I use to decorate controller methods.
They are decorated with @Post, but I need to somehow get the full path of the resulting endpoint.

target for some reason is an empty object, so I don't have access to the class.

#

Ok. Resolved it on my own. Target is not really empty, but in console it will evaluate to {}.

    const controllerPath = Reflect.getMetadata(
      PATH_METADATA,
      item.target.constructor,
    );