How to use the actionhero.api.projectRoot function in actionhero

To help you get started, we’ve selected a few actionhero examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github actionhero / actionhero-angular-bootstrap-cors-csrf / initializers / sequelize.js View on Github external
connect: async () => {
        const dir = path.normalize(api.projectRoot + '/models')
        fs.readdirSync(dir).forEach((file) => {
          var nameParts = file.split('/')
          var name = nameParts[(nameParts.length - 1)].split('.')[0]
          api.models[name] = api.sequelize.sequelize.import(dir + '/' + file)
        })

        await api.sequelize.sequelize.sync()
      },