Access to strapi global outside module.exports

System Information
  • Strapi Version: 3.1.0-alpha.5
  • Operating System:
  • Database: mysql
  • Node Version: 14.5.0
  • Yarn Version:

Hi! how are you?

i’m trying to access to a strapi global inside /api folder but outside service’s module.exports and i get the following error:

TypeError: Cannot read property ‘findOne’ of undefined

My question is, how can i access to strapi global variable outside module.exports?

e.g (this is just an example!)

//api/books/services/books.js

const book = (bookId) => {
 return strapi.services.books.findOne(bookId, [])
}

module.exports = {}

Thanks!!


any update of this? can anyone help me? thanks!