Node.jsأساسي

Correction d'une réponse JSON mal formatée

السيناريو

Contexte : Une API interne doit renvoyer des données JSON à un front-end. Le Problème : Le serveur renvoie du texte brut au lieu d'un JSON valide. Code actuel : res.write({ message: "OK" }); res.end(); Contraintes : Respecter les headers HTTP appropriés. Livrable attendu : Corriger l'implémentation pour renvoyer un JSON valide avec le header Content-Type correctement défini.

المهارات المستهدفة

nodejsjsonhttpapi

حالات تطبيقية أخرى في ⁨Node.js⁩

عرض كل الحالات التطبيقية في ⁨Node.js⁩

أسئلة أصلية من تصميم CodeDuel. لا ترتبط CodeDuel بأي ناشر أو هيئة اعتماد مذكورة؛ أسماء الشهادات والعلامات التجارية مملوكة لأصحابها، ولا تُذكر إلا للإشارة إلى المجال الذي يغطيه الاختبار. الإبلاغ عن محتوى