Skip to content

Search bar & requests to server

Francesco Moro edited this page Mar 21, 2016 · 2 revisions

Search URL

The search button should make a request to the server. The request url will contain two key value pairs:

  • q: the query string in the search bar input field (uri encoded)
  • categories: the categories that have been selected (clicked) from the dropdown menu

Sample URL formats

  • If no category has been selected, search for "beauty makeup":/search?q=beauty%20makeup&categories=
  • Categories Health and Sports selected, search "vitamin supplements":/search?q=vitamin%20%supplements&categories=Health,Sports

Database calls

The server will handle the request and call the database based on the url parameters, by calling the dbHelpers "getSearchResults" method, passing:

  • a categories array
  • a string of keywords
  • a callback on the results (an array of objects)
Clone this wiki locally