{"action":"created","issue":{"url":"https://api.github.com/repos/JBlaak/Express-Torch/issues/26","repository_url":"https://api.github.com/repos/JBlaak/Express-Torch","labels_url":"https://api.github.com/repos/JBlaak/Express-Torch/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/JBlaak/Express-Torch/issues/26/comments","events_url":"https://api.github.com/repos/JBlaak/Express-Torch/issues/26/events","html_url":"https://github.com/JBlaak/Express-Torch/issues/26","id":307325611,"number":26,"title":"Class controllers their methods loose this context","user":{"login":"DJWassink","id":1822404,"avatar_url":"https://avatars3.githubusercontent.com/u/1822404?v=4","gravatar_id":"","url":"https://api.github.com/users/DJWassink","html_url":"https://github.com/DJWassink","followers_url":"https://api.github.com/users/DJWassink/followers","following_url":"https://api.github.com/users/DJWassink/following{/other_user}","gists_url":"https://api.github.com/users/DJWassink/gists{/gist_id}","starred_url":"https://api.github.com/users/DJWassink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DJWassink/subscriptions","organizations_url":"https://api.github.com/users/DJWassink/orgs","repos_url":"https://api.github.com/users/DJWassink/repos","events_url":"https://api.github.com/users/DJWassink/events{/privacy}","received_events_url":"https://api.github.com/users/DJWassink/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"JBlaak","id":410113,"avatar_url":"https://avatars3.githubusercontent.com/u/410113?v=4","gravatar_id":"","url":"https://api.github.com/users/JBlaak","html_url":"https://github.com/JBlaak","followers_url":"https://api.github.com/users/JBlaak/followers","following_url":"https://api.github.com/users/JBlaak/following{/other_user}","gists_url":"https://api.github.com/users/JBlaak/gists{/gist_id}","starred_url":"https://api.github.com/users/JBlaak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JBlaak/subscriptions","organizations_url":"https://api.github.com/users/JBlaak/orgs","repos_url":"https://api.github.com/users/JBlaak/repos","events_url":"https://api.github.com/users/JBlaak/events{/privacy}","received_events_url":"https://api.github.com/users/JBlaak/received_events","type":"User","site_admin":false},"assignees":[{"login":"JBlaak","id":410113,"avatar_url":"https://avatars3.githubusercontent.com/u/410113?v=4","gravatar_id":"","url":"https://api.github.com/users/JBlaak","html_url":"https://github.com/JBlaak","followers_url":"https://api.github.com/users/JBlaak/followers","following_url":"https://api.github.com/users/JBlaak/following{/other_user}","gists_url":"https://api.github.com/users/JBlaak/gists{/gist_id}","starred_url":"https://api.github.com/users/JBlaak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JBlaak/subscriptions","organizations_url":"https://api.github.com/users/JBlaak/orgs","repos_url":"https://api.github.com/users/JBlaak/repos","events_url":"https://api.github.com/users/JBlaak/events{/privacy}","received_events_url":"https://api.github.com/users/JBlaak/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-03-21T16:39:03Z","updated_at":"2018-03-21T16:45:02Z","closed_at":null,"author_association":"COLLABORATOR","body":"take this for example:\r\n\r\n```ts\r\n\r\n    describe('classes as controller', function () {\r\n        it('should leave metadata empty if the user didnt set any', function () {\r\n\r\n            /* Given */\r\n            type myMetaData = { blaat: string };\r\n\r\n            let registeredPath: string|null = null;\r\n            let registeredMethod: ((req: Request, res: Response) => void)|null = null;\r\n\r\n            const app: any = {\r\n                get: (path: string, middleware: Array<(req: Request, res: Response, next: NextFunction) => any>, method: ((req: Request, res: Response) => void)) => {\r\n                    registeredPath = path;\r\n                    registeredMethod = method;\r\n                }\r\n            };\r\n\r\n            class foo {\r\n                private test = 'hello';\r\n\r\n                public method(req: Request, res: Response) {\r\n                    return this.test;\r\n                }\r\n            }\r\n            const fooInstance = new foo();\r\n\r\n            /* When */\r\n            const routes = Torch<myMetaData>(app as Application, router => {\r\n                router.get('/home', fooInstance.method);\r\n            });\r\n\r\n            /* Then */\r\n            expect(registeredPath).to.equal('/home');\r\n            expect(registeredMethod).to.equal(fooInstance.method);\r\n            console.warn((registeredMethod as any)(1 as any, 2 as any));\r\n        });\r\n    });\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/JBlaak/Express-Torch/issues/comments/375012213","html_url":"https://github.com/JBlaak/Express-Torch/issues/26#issuecomment-375012213","issue_url":"https://api.github.com/repos/JBlaak/Express-Torch/issues/26","id":375012213,"user":{"login":"DJWassink","id":1822404,"avatar_url":"https://avatars3.githubusercontent.com/u/1822404?v=4","gravatar_id":"","url":"https://api.github.com/users/DJWassink","html_url":"https://github.com/DJWassink","followers_url":"https://api.github.com/users/DJWassink/followers","following_url":"https://api.github.com/users/DJWassink/following{/other_user}","gists_url":"https://api.github.com/users/DJWassink/gists{/gist_id}","starred_url":"https://api.github.com/users/DJWassink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DJWassink/subscriptions","organizations_url":"https://api.github.com/users/DJWassink/orgs","repos_url":"https://api.github.com/users/DJWassink/repos","events_url":"https://api.github.com/users/DJWassink/events{/privacy}","received_events_url":"https://api.github.com/users/DJWassink/received_events","type":"User","site_admin":false},"created_at":"2018-03-21T16:45:02Z","updated_at":"2018-03-21T16:45:02Z","author_association":"COLLABORATOR","body":"Note express also doesn't handle this"}}
{"actor":{"display_login":"DJWassink"}}