Skip to content

Commit

Permalink
chore(mvc): Remove RouterController
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Remove RouterController. Use ExpressRouter insteadof.
  • Loading branch information
Romakita committed Dec 23, 2018
1 parent 66f0ff0 commit 62f147b
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 39 deletions.
1 change: 0 additions & 1 deletion packages/common/src/mvc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export * from "./components/LogIncomingRequestMiddleware";
// services
export * from "./services/ControllerService";
export * from "./services/MiddlewareService";
export * from "./services/RouterController";
export * from "./services/ExpressRouter";
export * from "./services/RouteService";

Expand Down
2 changes: 0 additions & 2 deletions packages/common/src/mvc/registries/ControllerRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {TypedProvidersRegistry, ProviderType, GlobalProviders} from "@tsed/di";
import {ControllerProvider} from "../class/ControllerProvider";
import {ExpressRouter} from "../services/ExpressRouter";
import {RouterController} from "../services/RouterController";

// tslint:disable-next-line: variable-name
export const ControllerRegistry: TypedProvidersRegistry = GlobalProviders.createRegistry(ProviderType.CONTROLLER, ControllerProvider, {
Expand All @@ -10,7 +9,6 @@ export const ControllerRegistry: TypedProvidersRegistry = GlobalProviders.create

onInvoke(provider: ControllerProvider, locals, designParamTypes) {
if (!locals.has(ExpressRouter)) {
locals.set(RouterController, new RouterController(provider.router));
locals.set(ExpressRouter, provider.router);
}
}
Expand Down
18 changes: 0 additions & 18 deletions packages/common/src/mvc/services/RouterController.ts

This file was deleted.

6 changes: 1 addition & 5 deletions test/units/mvc/registries/ControllerRegistry.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ControllerProvider, ExpressRouter, GlobalProviders, ProviderType, RouterController} from "@tsed/common";
import {ControllerProvider, ExpressRouter, GlobalProviders, ProviderType} from "@tsed/common";
import {expect} from "../../../tools";

describe("ControllerRegistry", () => {
Expand All @@ -13,10 +13,6 @@ describe("ControllerRegistry", () => {
settings.onInvoke!(this.provider, this.locals, []);
});

it("should store RouterController (deprecated)", () => {
expect(this.locals.has(RouterController)).to.eq(true);
});

it("should store ExpressRouter", () => {
expect(this.locals.has(ExpressRouter)).to.eq(true);
});
Expand Down
13 changes: 0 additions & 13 deletions test/units/mvc/services/RouterController.spec.ts

This file was deleted.

0 comments on commit 62f147b

Please sign in to comment.