I just want to read Stores/Orders Table of my site. Here is code in http-functions.js:
import { ok , notFound , serverError } from ‘wix-http-functions’ ;
import wixData from ‘wix-data’ ;
export function get_getOrders ( request ){
let options ={
“headers” :{
“content-type” : “application/json” ,
}
};
return wixData . query ( “Stores/Orders” )
. limit ( 10 )
. find ()
. then ( ( results ) => {
console . log ( results )
// matching items were found
if ( results . items . length > 0 ) {
options . body = {
“items” : results . items
};
return ok ( options );
}
// no matching items found
options . body = {
“error” : “not found!!!”
};
return notFound ( options );
} )
}
But i just keep receive nothing but server error with a get request
Other data table seem to work fine. Same code just replace reference to datatables.
What am i missing or doing wrong?
Thanks