Response successful when you try to paste or click the input after typing:
I’m getting this error Semantic UI search module. If I try in my browser this endpoint: https://observant-handsomely-vanadium.glitch.me/api/products/search?q=A52
it works. however if I set it at Semantic ui’s search api it returns error 503 on press of two letters? I tried also adding searchDelay and implemented cors in server.js but still error 503 persist.
I’'m using hello express app, and here is the code in my script.js:
$.fn.api.settings.api = {
'search': '/api/products/search?q={query}'
};
$(".ui.search").search({
// change search endpoint to a custom endpoint by manipulating apiSettings
type : 'category',
minCharacters : 1, // just under devel to make it easy
apiSettings : {
action: 'search'
},searchDelay: 200,
//searchFields: ["title"]
});
while this is my code at server.js:
// search products
app.get("/api/products/search", (request, response) => {
try {
axios
.get(productsUrlSearch.replace("%q",request.param("q")))
.then(responseProducts => {
response.json(responseProducts.data);
})
.catch(error => {
console.log(error);
});
} catch (err) {
console.error("GG", err);
}
});
I hope to get help from this else I will just try keyup function with jQuery instead.