Avoiding verbs in URLs
📖 Scenario: You are designing a simple REST API for a library system. The API should follow best practices by avoiding verbs in the URLs and instead use nouns to represent resources.
🎯 Goal: Build a set of REST API endpoint URLs that use nouns only, avoiding verbs, to represent actions on the library's books and authors.
📋 What You'll Learn
Create a list called
resources with the exact strings: 'books' and 'authors'Create a variable called
base_url with the exact value 'https://api.library.com/'Use a list comprehension called
endpoints to create URLs for listing and detail views for each resource, following REST best practices without verbsPrint the
endpoints list exactly as shown in the final output💡 Why This Matters
🌍 Real World
APIs that follow REST principles are easier to understand and maintain. Avoiding verbs in URLs helps keep the API clean and consistent.
💼 Career
Many software development jobs require designing or working with REST APIs that follow best practices, including proper URL design.
Progress0 / 4 steps