In FaasPlus, every function operates within an endpoint, and each endpoint is organized within a workspace. This structure ensures proper organization, access control, and scalability for each function. Endpoints provide various configuration options to customize their behavior, access, and execution environment.
Endpoints
Endpoint Properties
Each endpoint includes several key properties that determine how and where it runs:
- Workspace: The workspace in which the endpoint resides. Workspaces provide organizational and access control for endpoints.
- URL: The generated URL that provides external access to the endpoint in the format
{company_url}/{workspace_url}/{endpoint_url}
. - Server Specification: Select the server type (micro, medium, or large) for this endpoint. Each server specification includes its own timeout limits and rate limits, allowing you to control the endpoint’s performance and availability based on usage requirements.
- HTTP Method: Specify the HTTP method (GET, POST, PUT, or DELETE) to define how requests interact with the endpoint.
- Description: A brief description of the endpoint’s purpose. This can help clarify the endpoint’s function, especially in collaborative settings or when managing multiple endpoints.
Editing Endpoint Settings
All endpoint settings are configurable, allowing you to adapt the endpoint as your requirements evolve. You can update the workspace, server specification, URL, HTTP method, and description as needed. This flexibility helps ensure that each endpoint remains aligned with your project needs.
Code Execution Block
Each endpoint contains a code block where you can write or edit the JavaScript function that will be executed whenever the endpoint is called. This code is the core of your function, defining the operations that occur in response to requests made to the endpoint’s URL.
Once you save your code, it is ready for testing and deployment. Every time a request hits the endpoint, this code block will run, handling the request and returning a response based on your function logic.
Endpoint URL Structure
The endpoint URL is automatically generated based on the workspace and endpoint name, using the format:
{company_url}/{workspace_url}/{endpoint_url}
This URL provides unique access to each endpoint, enabling you to call and interact with the function from external applications or services.
Summary
Endpoints are the foundation for executing functions in FaasPlus, providing configurable settings and a dedicated URL for each function. By setting the server specifications, HTTP method, and custom JavaScript code, you can build and deploy powerful, scalable functions tailored to your application’s requirements.