Node.jsأساسي

Création d'une route POST avec parsing JSON

السيناريو

Contexte : Une API doit recevoir des données JSON envoyées par un client. Le Problème : Les données du body ne sont pas accessibles. Code actuel : app.post('/user', (req, res) => { console.log(req.body); res.send('ok'); }); Contraintes : Utiliser express.json(). Livrable attendu : Configurer correctement Express pour parser le body JSON et retourner les données reçues.

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

nodejsexpresspostjson

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

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

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