-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
function handlerForSearch (request, response) {
var searchTerm = request.url.split('?q=')[1];
response.writeHead(200, {'content-type': 'text/plain'});
response.end(JSON.stringify(runSmartMatch.smartMatch(searchTerm).slice(0, 10)));
}Incase there are any issues of the formatting of queries that are passed into this function, use a module like 'url', where you can use .parse methods to access different segments of the url (an object for query holds key and value pairs for the query).
You could then easily have a few checks to see if query formatting is correct and provide a fail case if not
Metadata
Metadata
Assignees
Labels
No labels