Google Cloud Run functions (Node.js) JavaScript
Google Cloud Run functions (Node.js) için, /pixel.gif isteklerine başlangıçta bir kez çözülen boş GIF ile yanıt veren bir JavaScript örneği.
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);
});
Bu örneği çalıştırıp döndürdüğü baytları karşılaştırdık.
Kontrol et
curl -sI http://localhost:8080/pixel.gif
Resmî site: Google Cloud Run functions (Node.js)