emptygif
भाषा: हिन्दी

सभी भाषाएँ और फ़्रेमवर्क

AdonisJS TypeScript

AdonisJS के लिए TypeScript स्निपेट, जो /pixel.gif पर आने वाली रिक्वेस्ट का जवाब empty GIF से देता है। GIF स्टार्टअप पर एक ही बार डिकोड होता है।

AdonisJS TypeScript

इंस्टॉल
npm init adonisjs@latest
फ़ाइल
routes.ts
चलाएँ
node ace serve --hmr
// start/routes.ts
import router from '@adonisjs/core/services/router';

const GIF = Buffer.from('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==', 'base64');

router.get('/pixel.gif', ({ response }) => {
  response.header('Content-Type', 'image/gif');
  response.header('Cache-Control', 'no-store');
  return response.send(GIF);
});

हमने यह स्निपेट चलाया और इसके लौटाए बाइट्स की तुलना की।

जाँचें

curl -sI http://localhost:8080/pixel.gif

आधिकारिक साइट: AdonisJS

TypeScript में और