Variable Usage

In FaasPlus, you can use workspace variables as a static repository to store values like remote host URLs, API keys, or other constants. This setup allows you to change these values easily in the workspace without modifying your code.


Getting full url

In this example, we’ll retrieve the full url from workspace variable definitions you can make api calls by using this url and it there is a changement in this url you can easily change in the workspace without changing the code.


const handleRequest = async (req) => {
    const base_url=req.vars.BASE_URL || 'Workspace does not have BASE_URL';
    return {
        url:base_url
    };
};
>response
{
    "url":"https://www.google.com"
}