How to bind .query property onto strapi object

System Information
  • 3.4.1:
  • MacOS 11.0.1 (20B29):
  • sqlite:
  • 12.18.4:
  • 6.14.6:
  • 1.22.10:

Can’t bind .query property onto strapi object to make queries through custom service of a plugin.

You can do this inside the bootstrap function.

An example of how I bind a long query:
/config/bootstrap.js:

module.exports = async () => {

strapi.getConfigs = async function () {
       return strapi.query('my-custom-configs', 'my-custom-plugin-with-configs').findOne();
    }
}

Now in all my project, I can call strapi.getConfigs()

Bootstrap.js documentation: https://strapi.io/documentation/developer-docs/latest/concepts/configurations.html#bootstrap

1 Like

Thanks for your involving. We have resolved the issue. It was some trouble in project as is.