موارد لا دوال
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
think in nouns (things) rather than verbs (actions).
الموضوعات المخطط لها
- A resource is a thing the API exposes: a product, a category, an order.
- A collection is a group of resources (
/products). A sub-resource belongs to a parent (/orders/7/items). - The HTTP method is the verb. The URL is the noun.
- Model from the domain requirements, not from database tables.
- The contract should not leak internal structure such as table names or database IDs by accident.
تفاصيل المخطط المبدئي
عرض عملي
| Bad (functions) | Good (resources) |
|---|---|
POST /createProduct | POST /products |
GET /getOrderItems?id=7 | GET /orders/7/items |
اختبر فهمك
What is the verb in DELETE /products/5?
أظهر الإجابة
DELETE, the method, not the path.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.