I tried to expose an http get function in order to get the list of users registered to my website, and possibly use it in an external application. I will use this application to allow registered users to book online directly through the said app.
However, when I test my recently created http-function, I get an error.
This is my code for the function:
export function get_usersQuery(request) {
const options = {
headers: {
“Content-Type”: “application/json”
}
};
return wixData.query(“Members/PrivateMembersData”).find().then( (results) => {
if (results.items.length > 0) {
options.body = {
“items”: results.items
};
return ok(options);
}
}). catch ( (error) => {
options.body = {
“error”: ${error} **this** is that error that idk what it is
}
return serverError(options);
});
}
BTW: I am accessing the API correctly /_functions/usersQuery
Can anyone help me? You guys are amazing already, helping me with this would be insanely awesome.
Thanks in Advance