Invoke Functions
Online functions can be invoked via HTTP.
Tips
Only deployed functions can be accessed in the real environment. If you don’t know how, see: Deployment.
Invoke via HTTP
For each deployed function, you can find its URL under the function name, and it will be copied when clicked.
Send an HTTP request (either GET or POST) to the URL to call the function.
We provide a sample function that can be called in a browser to view the results:
https://sample.hk.aircode.run/hello
https://sample.hk.aircode.run/hello
CORS
Cross-Origin Resource Sharing (aka CORS) is mainly used to initiate cross-origin requests from browsers. AirCode enables CORS support by default to ensure that all cross-domain requests can proceed normally. Rules are:
Access-Control-Allow-Origin
: It will be set according to theOrigin
value of the request, which allows cross-domain accessAccess-Control-Allow-Methods
: set toGET,HEAD,PUT,PATCH,POST,DELETE
, which allows all request methodsAccess-Control-Allow-Headers
: It will be set according to theAccess-Control-Request-Headers
of the request, which allows custom headersAccess-Control-Allow-Credentials
: NOT SET. For security reasons, cloud functions do not allow to carry identity information such as cookies when making cross-domain requests