Express route middleware #73

Closed
seanhess opened this Issue Nov 13, 2012 · 2 comments

Comments

Projects
None yet
2 participants
Contributor

seanhess commented Nov 13, 2012

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;
Contributor

seanhess commented Nov 13, 2012

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;
  }
}
Contributor

seanhess commented Nov 14, 2012

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