Skip to content

Commit

Permalink
Merge pull request #6 from AthennaIO/develop
Browse files Browse the repository at this point in the history
feat: create services provider
  • Loading branch information
jlenon7 authored Mar 31, 2022
2 parents 2a5bd1a + 9ab8fd1 commit bcba5fc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/core",
"version": "1.0.4",
"version": "1.0.5",
"description": "",
"license": "MIT",
"author": "João Lenon <[email protected]>",
Expand Down
28 changes: 28 additions & 0 deletions src/Providers/ServicesProvider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @athenna/core
*
* (c) João Lenon <[email protected]>
*
* 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 {}
}

0 comments on commit bcba5fc

Please sign in to comment.