You are building a RESTful API with Express to serve a mobile application. The mobile development team has asked for the ability to retrieve condensed responses to minimize data usage. How would you accommodate this request while maintaining the integrity of your API?
- Create separate endpoints for condensed and full responses.
- Use query parameters to allow clients to specify the response format.
- Disable compression to send smaller payloads.
- Use WebSocket instead of REST for real-time updates.
Using query parameters to allow clients to specify the response format is a common and RESTful approach to accommodating different client needs. Creating separate endpoints for each format can lead to redundancy and maintenance challenges. Disabling compression would likely increase, not decrease, data usage. Using WebSockets is for real-time communication and doesn't directly address response format concerns.
Loading...
Related Quiz
- How can you ensure the reliability of your tests in a scenario where external services have inconsistent behavior?
- In JavaScript, a closure is created when an inner function accesses the ________ of an outer function after the outer function has executed.
- What is the purpose of the break statement in JavaScript loops?
- In Express.js, to skip the remaining route callbacks and pass control to the next middleware function, you can call the ______ function.
- How can you implement template inheritance in Pug?