Search code examples
feathersjs

access property set in service setup() in hook


Setting a property in service setup(). Need to access that property in the service's hooks.

setup(app) {
    this.app = app;
    this.meta = { mod: 'verify' };
}

How to service property 'meta', in the service hook?

Tried context.service context.meta


Solution

  • The property was available in context.service, and accessed it as below

    const meta = context.service.meta;
    

    Not sure if there is any other way to access it.