
上QQ阅读APP看书,第一时间看更新
HTTP functions
HTTP functions are triggered remotely by performing an HTTP request on a Google provided URL. The invocation URL takes the following naming convention:
https://<REGION>-<PROJECT_ID>.cloudfunctions.net/<FUNCTION_NAME>
While there is currently no direct way to modify HTTP function URLs, there are a number of methods for making functions available behind custom URLs. The simplest method for achieving this is by providing a simple forward proxy running on Compute Engine using technologies such as NGINX. Another approach is through the use of a Firebase application.
When a network request is made to this URL, the function will be invoked. HTTP functions are defined as Express.js handlers, which take two input parameters: a request object and a response object. Cloud Functions will make all request data available within the request object. The function can take action based on this data before using the response object to perform a callback with any results.