Issue 276-Modify the search API and separate it from routes/search.js