عرض عملي: بناء ميزة المنتجات طبقة بطبقة
في هذا الدرس 3 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
build GET /products and GET /products/{id}; prepares JNR-013-LAB1.
تفاصيل المخطط المبدئي
خطوة بخطوة
- Create the
Productdomain class andProductRepositoryinterface. - Implement
InMemoryProductRepositorywith aMapand sample data. - Write
ProductServicewithlist()andget(id). - Planned mistake: put the "not found" decision and a price calculation in the controller. Fix: move both into the service; the controller only delegates.
- Write
ProductController, run the app, and call both endpoints withcurl.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.