Business Logic

FaasPlus enables you to write custom business logic and deploy it seamlessly as functions. This approach allows for real-time monitoring, fine-tuning, and scaling, providing more flexibility and control than embedding business logic directly in your code. With FaasPlus, your logic is managed independently, making it easy to update and maintain while keeping your core codebase streamlined and adaptable.


In this example, we send an amount of 10000 to determine whether to proceed with the transaction. This endpoint allows you to externalize your business logic, keeping it separate from your core code.


const handleRequest = async (req) => {
    const amount = req.params.amount || 0;
    const TX_LIMIT = req.vars.TX_LIMIT || 0;        
    if (amount <= TX_LIMIT) {
        return {
            status:true,
            desc:'You can make this transaction'
        }
    } 
    
    return {
        status:false,
        desc:`You cannot make this transaction. Transaction limit is (${TX_LIMIT})`
    }             
};

>response
{
    "status": false,
    "desc": "You can not make this transaction, Transaction limit is (1000)"
}