Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
feat(server): provided in root injectables (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiisol authored Aug 9, 2023
1 parent c4b739b commit 252a39d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 18 deletions.
2 changes: 0 additions & 2 deletions server/example/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import { HttpModule } from '@server/http';

import { MiscModule, PostsModule } from './modules';
import { ServerPipe } from './pipes';
import { ServicesModule } from './services';

@Module({
modules: [
HttpModule.create(ExpressAdapter),
ServicesModule,
MiscModule,
PostsModule,
],
Expand Down
1 change: 0 additions & 1 deletion server/example/services/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { PostsService } from './posts.service';
export { ServicesModule } from './services.module';
2 changes: 1 addition & 1 deletion server/example/services/posts.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@server';

@Injectable()
@Injectable({ providedIn: 'root' })
export class PostsService {
getPosts() {
return [
Expand Down
8 changes: 0 additions & 8 deletions server/example/services/services.module.ts

This file was deleted.

6 changes: 3 additions & 3 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"license": "MIT",
"name": "@decorators/server",
"peerDependencies": {
"@decorators/di": "^3.0.1",
"@decorators/di": "^3.1.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"reflect-metadata": "^0.1.13"
Expand All @@ -69,5 +69,5 @@
]
}
},
"version": "1.0.0-beta.6"
"version": "1.0.0-beta.7"
}
4 changes: 3 additions & 1 deletion server/src/core/application.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InjectionToken } from '@decorators/di';
import { InjectionToken, RootContainer } from '@decorators/di';

import { ContainerManager, ModuleResolver, ROOT_MODULE } from './helpers';
import { DEFAULT_PROVIDERS } from './providers';
Expand All @@ -9,6 +9,8 @@ export class Application {
const containerManger = new ContainerManager();
const container = containerManger.create(Application);

container.setParent(RootContainer);

container.provide([
{
provide: ContainerManager,
Expand Down

0 comments on commit 252a39d

Please sign in to comment.