How to secure endpoint

With FaasPlus, you can secure your API endpoints by selecting an authorization method to prevent unauthorized access. Choose from various options: None: Open access without restrictions. Basic: Requires a username and password for each request. API Key: Provides an additional layer of security by requiring an API key for access. Static IP Restriction: Limits access to specified IP addresses only, ensuring that only trusted sources can connect. This flexible authorization setup empowers you to control access levels based on your security needs, keeping your API protected and reliable.


API Key Security

In this example, the endpoint is secured with an API Key. To access the service, include '_SECRET_' as the X-API-KEY in your request header. If the correct key is not provided, a 401 Unauthorized response will be returned.


const handleRequest = async (req) => {
    return {
        'message':'If you can see this you provide correct X-API-KEY in the header'
    };
}

>response
{ 
    'message':'If you can see this you provide correct X-API-KEY in the header'
}