I am playing with the Google Cloud Functions API and I´m confused how to use it the right way for a simple REST API to retrieve some data from a database and respond to the client with the data its need.
I´m using serverless to deploy my code that looks like this for a function.
exports.http = (request, response) => {
response.status(200).send('Hello World!');
};
but this is just a simple 200 (OK)
response with no data from a database.
Coming from MVC frameworks like Rails or Django I would write a controller action to retrieve some data from my database and render a JSON for the response but Google Cloud Functions is working different by just having functions and nothing else.
Where should I store my database (with Google Cloud Services) and how can I retrieve the data in a function? Do I have to call some kind of Database API and process the result and send it back as JSON inside a function?