Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Problem
- We are in need of a new search component to help our users discover our amazing deals. You are tasked to implement this feature.
- This feature requires a single backend endpoint as well as the component that consumes it.
- Please write your code in a git repository.
- Ensure proper commit message through out the exercise so that we can understand your thought process.
- ## Backend
- 1. Write a search endpoint which returns a deal list that is paginatable
- - You are allowed to use any backend language. Bonus point for writing it in Ruby/Elixir/Node
- - You do not need to implement the data store. Use mock data where possible. (Big enough to handle pagination)
- - Bonus point for writing tests
- Here is the specification for the endpoint:
- Request
- ```
- GET /search
- {
- "query": String,
- "limit": Number,
- "page": Number
- }
- ```
- Response
- ```
- {
- "entries": [
- { "id": Number, "name": String, "discounted_price": String, "price": String, "outlet": {"id": Number, "name": String} }
- ],
- "page": {
- "total_entries": Number,
- "total_pages": Number
- }
- }
- ```
- ## Frontend
- 2. Build a search component that requests the search endpoint and display results, extend it to autocomplete on change, handle key navigation through the results and extend it to be infinitely scrollable.
- - You are not allowed to use plug and play solution, but you may use other dependency to help build this widget.
- - You may use any modern frontend framework. Bonus point for using React
- - Bonus point for writing tests
Add Comment
Please, Sign In to add comment