{"action":"closed","issue":{"url":"https://api.github.com/repos/backstage/functions/issues/11","repository_url":"https://api.github.com/repos/backstage/functions","labels_url":"https://api.github.com/repos/backstage/functions/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/backstage/functions/issues/11/comments","events_url":"https://api.github.com/repos/backstage/functions/issues/11/events","html_url":"https://github.com/backstage/functions/issues/11","id":181005106,"number":11,"title":"New contract for the functions with request and response","user":{"login":"pedrosnk","id":78858,"avatar_url":"https://avatars.githubusercontent.com/u/78858?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrosnk","html_url":"https://github.com/pedrosnk","followers_url":"https://api.github.com/users/pedrosnk/followers","following_url":"https://api.github.com/users/pedrosnk/following{/other_user}","gists_url":"https://api.github.com/users/pedrosnk/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrosnk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrosnk/subscriptions","organizations_url":"https://api.github.com/users/pedrosnk/orgs","repos_url":"https://api.github.com/users/pedrosnk/repos","events_url":"https://api.github.com/users/pedrosnk/events{/privacy}","received_events_url":"https://api.github.com/users/pedrosnk/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"pedrosnk","id":78858,"avatar_url":"https://avatars.githubusercontent.com/u/78858?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrosnk","html_url":"https://github.com/pedrosnk","followers_url":"https://api.github.com/users/pedrosnk/followers","following_url":"https://api.github.com/users/pedrosnk/following{/other_user}","gists_url":"https://api.github.com/users/pedrosnk/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrosnk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrosnk/subscriptions","organizations_url":"https://api.github.com/users/pedrosnk/orgs","repos_url":"https://api.github.com/users/pedrosnk/repos","events_url":"https://api.github.com/users/pedrosnk/events{/privacy}","received_events_url":"https://api.github.com/users/pedrosnk/received_events","type":"User","site_admin":false},"assignees":[{"login":"pedrosnk","id":78858,"avatar_url":"https://avatars.githubusercontent.com/u/78858?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrosnk","html_url":"https://github.com/pedrosnk","followers_url":"https://api.github.com/users/pedrosnk/followers","following_url":"https://api.github.com/users/pedrosnk/following{/other_user}","gists_url":"https://api.github.com/users/pedrosnk/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrosnk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrosnk/subscriptions","organizations_url":"https://api.github.com/users/pedrosnk/orgs","repos_url":"https://api.github.com/users/pedrosnk/repos","events_url":"https://api.github.com/users/pedrosnk/events{/privacy}","received_events_url":"https://api.github.com/users/pedrosnk/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2016-10-04T21:07:17Z","updated_at":"2016-10-13T18:52:02Z","closed_at":"2016-10-13T18:52:02Z","body":"Let's create a new contract to execute the functions that we can encapsulate the request and the response of our requests and pass it forward to our functions.\r\n\r\nthe new way to write functions will be\r\n\r\n```javascript\r\nfunction foo(request, response) {\r\n  response.status(200).send({\"response\": \"ok\"})\r\n}\r\n```\r\n\r\nThe `request` object will contain the `body` that will indicate the body of the request the `headers`, which will contains the request headers and the `query` with the query string from the request.\r\n\r\nThe `response` object will contain the `send` method which will be invoked when it is needed to send back a response, the `status` method that will be used to set the status of the response and the `set` that will be used to set the headers of the response."}}
{"actor":{"display_login":"pedrosnk"}}