Speeding up serverless function response times in deployments like in Vercel - 0 views
Extracted from the following link.
Just add the following code where you can access the response object.
res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");
s-maxage value according to how long you want the CDN to cache the response (in seconds).