Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New contract for the functions with request and response #11

Closed
pedrosnk opened this issue Oct 4, 2016 · 0 comments
Closed

New contract for the functions with request and response #11

pedrosnk opened this issue Oct 4, 2016 · 0 comments
Assignees

Comments

@pedrosnk
Copy link
Contributor

pedrosnk commented Oct 4, 2016

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.

the new way to write functions will be

function foo(request, response) {
  response.status(200).send({"response": "ok"})
}

The 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.

The 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.

pedrosnk added a commit to pedrosnk/functions that referenced this issue Oct 10, 2016
As described on the issue globocom#11 this introuces the SandboxResponse object
that makes possible for the function to send custom body, headers and
status code
pedrosnk added a commit that referenced this issue Oct 10, 2016
This commits changes the way we run our function in the cloud, before we
passed the args and a callback function, now a req object is
deliveried with the basic content that is needed and a res object. One
can set the response, add headers and change the status code of the
response.
pedrosnk added a commit that referenced this issue Oct 13, 2016
Add test to make it possible to include arbitrary library into the
function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant