Skip to content

Commit

Permalink
Merge pull request #36 from jdelobel/regExp-can-now-be-used-for-route…
Browse files Browse the repository at this point in the history
…-options-without-path

RegExp can now be used for route options without path option
  • Loading branch information
remojansen authored Mar 31, 2017
2 parents a8a9d33 + 4b19d6e commit c4c629a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace interfaces {
target: any;
}

export type RouteOptions = string | { path: string | RegExp } & Object;
export type RouteOptions = string | RegExp | { path: string | RegExp } & Object;

export interface ControllerMethodMetadata {
options: RouteOptions;
Expand Down
2 changes: 1 addition & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class InversifyRestifyServer {
if (controllerMetadata && methodMetadata) {
methodMetadata.forEach((metadata: interfaces.ControllerMethodMetadata) => {
let handler: restify.RequestHandler = this.handlerFactory(controllerMetadata.target.name, metadata.key);
let routeOptions = typeof metadata.options === "string" ? { path: metadata.options } : metadata.options;
let routeOptions: any = typeof metadata.options === "string" ? { path: metadata.options } : metadata.options;
if (typeof routeOptions.path === "string" && typeof controllerMetadata.path === "string"
&& controllerMetadata.path !== "/") {
routeOptions.path = controllerMetadata.path + routeOptions.path;
Expand Down

0 comments on commit c4c629a

Please sign in to comment.