diff --git a/package.json b/package.json index 9c46467..1e069d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/core", - "version": "1.0.4", + "version": "1.0.5", "description": "", "license": "MIT", "author": "João Lenon ", diff --git a/src/Providers/ServicesProvider.ts b/src/Providers/ServicesProvider.ts new file mode 100644 index 0000000..2604722 --- /dev/null +++ b/src/Providers/ServicesProvider.ts @@ -0,0 +1,28 @@ +/** + * @athenna/core + * + * (c) João Lenon + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +import { Path } from '@secjs/utils' +import { ServiceProvider } from '@athenna/ioc' +import { getAppFiles } from 'src/Utils/getAppFiles' +import { ResolveClassExport } from 'src/Utils/ResolveClassExport' + +export class ServicesProvider extends ServiceProvider { + boot(): void { + const controllers = getAppFiles(Path.app('Services')) + + controllers.forEach(File => { + this.container.bind( + `App/Services/${File.name}`, + ResolveClassExport.resolve(require(File.path)), + ) + }) + } + + register(): void {} +}