Merge pull request #31890 from Guillaume-Mayer/koa-router-fix-context

[koa-router] fix IRouterContext
This commit is contained in:
Sheetal Nandi
2019-01-04 08:57:17 -08:00
committed by GitHub
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ declare namespace Router {
strict?: boolean;
}
export interface IRouterContext {
export interface IRouterContext extends Koa.Context {
/**
* url params
*/
+4
View File
@@ -49,6 +49,10 @@ const match = router.match('/users/:id', 'GET');
let layer: Router.Layer
let layerOptions: Router.ILayerOptions
const mw: Router.IMiddleware = (ctx: Router.IRouterContext, next: () => Promise<any>) => {
ctx.body = "Ok";
};
app.use(router.routes());
app.use(router.allowedMethods());