jin-frame: एक reusable, declarative, type-safe और extendable HTTP request library.
(github.com/imjuni)यह axios-आधारित HTTP request client है। इसमें HTTP request को TypeScript classes के रूप में define किया जा सकता है।
वास्तविक प्रोजेक्ट्स में काम करते समय अक्सर endpoint के हिसाब से timeout, retry count, retry strategy आदि को अलग-अलग manage करना पड़ता है, या common patterns लिखने होते हैं, और failure होने पर logging जोड़ने जैसी कई तरह की requirements आती हैं।
मैंने axios, fetch, ky जैसे कई clients इस्तेमाल किए, लेकिन ऐसा client नहीं मिला जो इन requirements को अपेक्षाकृत आसानी से पूरा कर सके, इसलिए मैंने इसे develop किया।
@Get({ host: 'https://pokeapi.co', path: '/api/v2/pokemon/:name' })
export class PokemonFrame extends JinFrame {
@Param()
declare public readonly name: string;
}
const frame = PokemonFrame.of({ name: 'pikachu' });
const reply = await frame.execute();
console.log(reply);
Inheritance के जरिए Hook को extend किया जा सकता है, और timeout, retry count आदि को हर class के लिए अलग-अलग manage किया जा सकता है, इसलिए यह उपयोगी है।
इसे इस्तेमाल करके देखें, और बहुत-सा feedback दें!
अभी कोई टिप्पणी नहीं है.