அனைத்து மொழிகளும் ஃப்ரேம்வொர்க்குகளும்
Firebase Cloud Functions + Hosting JavaScript
/pixel.gif க்கு வரும் ரெக்வெஸ்ட்களுக்கு empty GIF மூலம் பதிலளிக்கும், Firebase Cloud Functions + Hosting க்கான JavaScript ஸ்னிப்பெட். GIF ஸ்டார்ட்அப்பில் ஒருமுறை மட்டுமே டீகோட் செய்யப்படுகிறது.
Firebase Cloud Functions + Hosting JavaScript
// functions/index.js - and in firebase.json:
// "hosting": { "rewrites": [{ "source": "/pixel.gif", "function": { "functionId": "pixel" } }] }
import { onRequest } from 'firebase-functions/https';
const GIF = Buffer.from('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==', 'base64');
export const pixel = onRequest((req, res) => {
res.set('Cache-Control', 'no-store').type('gif').send(GIF);
});
இந்த ஸ்னிப்பெட்டை கம்பைல் அல்லது டைப்-செக் செய்தோம்.
சரிபார்
curl -sI http://localhost:8080/pixel.gif
அதிகாரப்பூர்வ சைட்: Firebase Cloud Functions + Hosting