{"action":"created","issue":{"url":"https://api.github.com/repos/sdogruyol/kemal/issues/25","labels_url":"https://api.github.com/repos/sdogruyol/kemal/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/sdogruyol/kemal/issues/25/comments","events_url":"https://api.github.com/repos/sdogruyol/kemal/issues/25/events","html_url":"https://github.com/sdogruyol/kemal/issues/25","id":120582096,"number":25,"title":"Instead of passing `Kemal::context.new` as `env` in route's callback, we should have something like Express.js","user":{"login":"ilatif","id":1183802,"avatar_url":"https://avatars.githubusercontent.com/u/1183802?v=3","gravatar_id":"","url":"https://api.github.com/users/ilatif","html_url":"https://github.com/ilatif","followers_url":"https://api.github.com/users/ilatif/followers","following_url":"https://api.github.com/users/ilatif/following{/other_user}","gists_url":"https://api.github.com/users/ilatif/gists{/gist_id}","starred_url":"https://api.github.com/users/ilatif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilatif/subscriptions","organizations_url":"https://api.github.com/users/ilatif/orgs","repos_url":"https://api.github.com/users/ilatif/repos","events_url":"https://api.github.com/users/ilatif/events{/privacy}","received_events_url":"https://api.github.com/users/ilatif/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-05T19:33:30Z","updated_at":"2015-12-05T19:45:31Z","closed_at":null,"body":"Crystal is quite a fun programming language to work with. I have been trying to remove `env.redirect` etc. to simplify method calls to something like `redirect`. I actually want to do this because in my opinion when `kemal` has support for templates having template getting rendered as `env.render` is not going to look cool.\r\n\r\nDue to some core differences in Ruby and Crystal I' am unable to achieve this so far because there is no `self` in Crystal inside blocks which makes sense but this also means that we cannot apart `env` from method calls inside defined routes' callback.\r\n\r\nHowever, there is a simple solution. Instead of passing something like `env`, we should pass something like `req` and `res`. For example,\r\n\r\n```ruby\r\n  get \"/\" do |req, res|\r\n    # important stuff here\r\n  end\r\n````\r\n\r\nThis will make method invocations more expressive and we can call appropriate methods on proper objects. For example to access `params` we can call `req.params` and to redirect we can call `res.redirect` and to render we can do `res.render`.\r\n\r\nThis is what Express.js is doing and I think it's quite elegant."},"comment":{"url":"https://api.github.com/repos/sdogruyol/kemal/issues/comments/162240564","html_url":"https://github.com/sdogruyol/kemal/issues/25#issuecomment-162240564","issue_url":"https://api.github.com/repos/sdogruyol/kemal/issues/25","id":162240564,"user":{"login":"sdogruyol","id":990485,"avatar_url":"https://avatars.githubusercontent.com/u/990485?v=3","gravatar_id":"","url":"https://api.github.com/users/sdogruyol","html_url":"https://github.com/sdogruyol","followers_url":"https://api.github.com/users/sdogruyol/followers","following_url":"https://api.github.com/users/sdogruyol/following{/other_user}","gists_url":"https://api.github.com/users/sdogruyol/gists{/gist_id}","starred_url":"https://api.github.com/users/sdogruyol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdogruyol/subscriptions","organizations_url":"https://api.github.com/users/sdogruyol/orgs","repos_url":"https://api.github.com/users/sdogruyol/repos","events_url":"https://api.github.com/users/sdogruyol/events{/privacy}","received_events_url":"https://api.github.com/users/sdogruyol/received_events","type":"User","site_admin":false},"created_at":"2015-12-05T19:45:31Z","updated_at":"2015-12-05T19:45:31Z","body":"I think instead of yielding ```res```and ```res``` we better find a way to use this function like ```render``or ```redirect```"}}