Google Cloud Run functions (Node.js) JavaScript
Snippet JavaScript kanggo Google Cloud Run functions (Node.js) sing mangsuli request menyang /pixel.gif nganggo empty GIF, sing didekode sepisan nalika startup.
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);
});
Snippet iki wis dilakokake lan byte asile wis dibandhingake.
Priksa
curl -sI http://localhost:8080/pixel.gif
Situs resmi: Google Cloud Run functions (Node.js)