Simple Ping Example
Creating a ping service in FaasPlus is straightforward and simple. Here’s how it works:
const handleRequest = async () => {
return 'pong';
};
>response
pong
Now, let’s enhance our example to include the execution time. This version returns both the "pong"
response and the
current date and time using the new Date()
function.
const handleRequest = async () => {
const executedAt = new Date().toString();
return {
res: 'pong',
executed_at: executedAt
};
};
>response
{
"res": "pong",
"executed_at": "Thu Sep 12 2024 12:43:23 GMT+0000 (Coordinated Universal Time)"
}