Blocks allows you to create functions to expose the functionality of your app as a service.
You can use it in sites where your app is installed by calling your app's APIs, as defined by the functions you create in the http-functions.js
file.
This feature is very similar to exposing site APIs through HTTP functions, but with a slightly different syntax.
To create HTTP functions:
Each function you define in http-functions.js
is accessible through a unique endpoint, allowing external requests to interact with your app’s features and allowing you to test them.
Clients consume your HTTP functions by reaching endpoints using the following pattern:
Premium sites: https:/{user_domain}/_functions/<app_namespace>-backend/<function_name>?<optional_parameter>
For example:
Free sites: https://{user_name}.wixsite.com/{site_name}/_functions/<app_namespace>-backend/<function_name>?<optional_parameter>
For example:
You can test your HTTP functions by reaching endpoints using the following pattern:
Premium sites: https://www.{user_domain}/_functions-dev/<app_namespace>-backend/<functionName>?<optional_parameter>
For example:
Free sites: https://{user_name}.wixsite.com/{site_name}/_functions-dev/<app_namespace>-backend/<function_name>?<optional_parameter>
For example: