Custom helper functions

I did solve it

under the config folder I created a functions folder and you create a js file named for what you are doing:
eg myfunction.js

inside this file

module.exports = {
  async func1(input1, input2) {
    // do your work here
 },
}

Now the part that made it work was I had to import it in my controllers or where ever you want to use it

ie const {func1} = require("…/…/…/…/config/functions/myfunction");

Hope it help

1 Like