Bird
0
0

Which of the following is the correct way to configure an API Gateway to route requests to a backend service named user-service?

easy📝 Syntax Q12 of 15
Rest API - Advanced Patterns
Which of the following is the correct way to configure an API Gateway to route requests to a backend service named user-service?
A"/users": "user-service/api/v1/users"
B"/users": "http://user-service/api/v1/users"
C"users": "http://user-service/api/v1/users"
D"/users": "http://user-service/api/v1"
Step-by-Step Solution
Solution:
  1. Step 1: Check URL path and protocol

    The route key should start with a slash and the backend URL must include the protocol (http://) and full path.
  2. Step 2: Validate each option

    "/users": "http://user-service/api/v1/users" correctly uses "/users" as route and full URL with protocol and path. "/users": "user-service/api/v1/users" misses protocol. "users": "http://user-service/api/v1/users" misses leading slash in route. "/users": "http://user-service/api/v1" misses the full path to users.
  3. Final Answer:

    "/users": "http://user-service/api/v1/users" -> Option B
  4. Quick Check:

    Route starts with / and URL includes http:// [OK]
Quick Trick: Routes start with / and backend URLs need protocol [OK]
Common Mistakes:
MISTAKES
  • Omitting http:// in backend URL
  • Missing leading slash in route path
  • Using incomplete backend service path

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes