Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Express route middleware #73

Closed
seanhess opened this Issue · 2 comments

2 participants

@seanhess

I think these are wrong.

post(path: string, callbacks: any, callback: () => void ): void;

Shouldn't it be something more like:

interface IExpressHandler {
    (req: express.ServerRequest, res:express.ServerResponse, next?:Function):void;
}

....
post(path: string, ...handlers: IExpressHandler[] ): void;
@seanhess

More fun codez that compile:

module express2 {

  export interface IHandler {
    (req: express.ServerRequest, res:express.ServerResponse):void;
  }

  export interface ServerApplication extends express.ServerApplication {
    get(name: string): any;
    get(path: string, handler: IHandler ): void;
    get(path: RegExp, handler: IHandler ): void;
    get(path: string, ...callbacks: IHandler[]): void;
    //get(path: string, callbacks: any, callback: () => void ): void;

    post(path: string, handler: IHandler ): void;
    post(path: RegExp, handler: IHandler ): void;
    post(path: string, ...callbacks: IHandler[]): void;
    //post(path: string, callbacks: any, callback: () => void ): void;
  }
}
@seanhess

I'm going to make a pull request for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.