In FaasPlus, publishing a function makes it live and accessible via its endpoint URL. Before you can publish your code, the endpoint must be in a stopped or draft state, as editing is restricted when the endpoint is actively running.
Publishing Your Functions
Editing and Testing Your Code
To make changes to your function, ensure the endpoint is stopped or in draft mode. Once in an editable state, click the Edit button to access the code editor. Here, you can:
- Modify the JavaScript code to adjust the function logic.
- Access workspace variables, which can be used directly in your function.
- Pass query string parameters to simulate real-world inputs and test your function comprehensively.
When you are ready to validate your code, use the Test button to execute the function with your test inputs. This allows you to confirm that your function performs as expected before publishing.
Publishing Your Code
If your function passes the test, you can proceed to save and publish it. Once published, the function becomes live and accessible via its unique endpoint URL.
Note: If your code fails during testing, it will not be published. Instead, an error message will display, detailing the issue. Make necessary adjustments to resolve the error, then test your code again until it succeeds. Only then will you be able to save the changes and publish the function.
Summary
Publishing your function involves careful testing and validation to ensure accuracy and reliability. By stopping the endpoint, making edits, and testing thoroughly, you can confidently deploy your function for production use, knowing it will perform as intended.