Express JavaScript
Express için, /pixel.gif isteklerine başlangıçta bir kez çözülen boş GIF ile yanıt veren bir JavaScript örneği.
Express JavaScript
import express from 'express';
const GIF = Buffer.from('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==', 'base64');
const app = express();
app.get('/pixel.gif', (req, res) => {
res.set('Cache-Control', 'no-store');
res.type('gif').send(GIF);
});
app.listen(8080);
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
JavaScript için daha fazlası
- Fastify
- Node.js standard library (node:http)
- Koa
- hapi
- AWS Lambda (Node.js)
- AWS Lambda@Edge (CloudFront)
- Google Cloud Run functions (Node.js)
- Firebase Cloud Functions + Hosting
- Azure Functions (Node.js v4 model)
- Fastly Compute (JavaScript)
- nginx JavaScript (njs)
- Node.js one-liner
- Bun one-liner
- React component (JSX)