{"action":"created","issue":{"url":"https://api.github.com/repos/totaljs/framework/issues/690","repository_url":"https://api.github.com/repos/totaljs/framework","labels_url":"https://api.github.com/repos/totaljs/framework/issues/690/labels{/name}","comments_url":"https://api.github.com/repos/totaljs/framework/issues/690/comments","events_url":"https://api.github.com/repos/totaljs/framework/issues/690/events","html_url":"https://github.com/totaljs/framework/issues/690","id":395059180,"node_id":"MDU6SXNzdWUzOTUwNTkxODA=","number":690,"title":"How to find out which get and post request called in same function handler?","user":{"login":"Pourya8366","id":7686319,"node_id":"MDQ6VXNlcjc2ODYzMTk=","avatar_url":"https://avatars1.githubusercontent.com/u/7686319?v=4","gravatar_id":"","url":"https://api.github.com/users/Pourya8366","html_url":"https://github.com/Pourya8366","followers_url":"https://api.github.com/users/Pourya8366/followers","following_url":"https://api.github.com/users/Pourya8366/following{/other_user}","gists_url":"https://api.github.com/users/Pourya8366/gists{/gist_id}","starred_url":"https://api.github.com/users/Pourya8366/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pourya8366/subscriptions","organizations_url":"https://api.github.com/users/Pourya8366/orgs","repos_url":"https://api.github.com/users/Pourya8366/repos","events_url":"https://api.github.com/users/Pourya8366/events{/privacy}","received_events_url":"https://api.github.com/users/Pourya8366/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-01-01T06:13:53Z","updated_at":"2019-01-01T09:47:48Z","closed_at":null,"author_association":"NONE","body":"According to this example:\r\n```\r\nROUTE('GET /api/users/', action);\r\nROUTE('POST /api/users/', action);\r\n```\r\n\r\nin the body of function `action` how we can find out get or post request has been called so that write appropriate code?\r\n"},"comment":{"url":"https://api.github.com/repos/totaljs/framework/issues/comments/450719283","html_url":"https://github.com/totaljs/framework/issues/690#issuecomment-450719283","issue_url":"https://api.github.com/repos/totaljs/framework/issues/690","id":450719283,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDcxOTI4Mw==","user":{"login":"petersirka","id":2414252,"node_id":"MDQ6VXNlcjI0MTQyNTI=","avatar_url":"https://avatars3.githubusercontent.com/u/2414252?v=4","gravatar_id":"","url":"https://api.github.com/users/petersirka","html_url":"https://github.com/petersirka","followers_url":"https://api.github.com/users/petersirka/followers","following_url":"https://api.github.com/users/petersirka/following{/other_user}","gists_url":"https://api.github.com/users/petersirka/gists{/gist_id}","starred_url":"https://api.github.com/users/petersirka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petersirka/subscriptions","organizations_url":"https://api.github.com/users/petersirka/orgs","repos_url":"https://api.github.com/users/petersirka/repos","events_url":"https://api.github.com/users/petersirka/events{/privacy}","received_events_url":"https://api.github.com/users/petersirka/received_events","type":"User","site_admin":false},"created_at":"2019-01-01T09:47:48Z","updated_at":"2019-01-01T09:47:48Z","author_association":"COLLABORATOR","body":"Why do you use only the one action?\r\n\r\n```javascript\r\nROUTE('GET,POST /api/users/', action);\r\n\r\nfunction action() {\r\n    var self = this;\r\n    if (self.req.method === 'POST') {\r\n\r\n    }\r\n}\r\n```\r\n\r\n__BETTER__:\r\n\r\n```javascript\r\nROUTE('GET /api/users/', action_get);\r\nROUTE('POST /api/users/', action_post);\r\n\r\nfunction action_get() {\r\n    this.json({ success: true });\r\n}\r\n\r\nfunction action_post() {\r\n    this.json({ success: true });\r\n}\r\n```"}}
{"actor":{"display_login":"petersirka"}}