Todas as linguagens e frameworks
Google Cloud Run functions (Node.js) JavaScript
Um snippet em JavaScript para Google Cloud Run functions (Node.js) que responde às requisições para /pixel.gif com o GIF vazio, decodificado uma única vez na inicialização.
Google Cloud Run functions (Node.js) JavaScript
import * as functions from '@google-cloud/functions-framework';
const GIF = Buffer.from('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==', 'base64');
functions.http('pixel', (req, res) => {
if (req.path !== '/pixel.gif') {
res.sendStatus(404);
return;
}
res.set('Cache-Control', 'no-store').type('gif').send(GIF);
});
Executamos este snippet e comparamos os bytes que ele retornou.
Verificar
curl -sI http://localhost:8080/pixel.gif
Site oficial: Google Cloud Run functions (Node.js)