Todos los lenguajes y frameworks
Google Cloud Run functions (Node.js) JavaScript
Un fragmento en JavaScript para Google Cloud Run functions (Node.js) que responde a las peticiones a /pixel.gif con el GIF vacío, decodificado una sola vez al arrancar.
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);
});
Ejecutamos este fragmento y comparamos los bytes que devolvió.
Comprobar
curl -sI http://localhost:8080/pixel.gif
Sitio oficial: Google Cloud Run functions (Node.js)