You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constquery={"query":"SELECT c.fullname AS customer,b.title AS book,(b.price*ob.quantity) AS subtotal,o.id AS order_id \FROM order_books AS ob \INNER JOIN books AS b ON ob.book_id=b.id \INNER JOIN orders AS o ON ob.order_id=o.id \INNER JOIN customers AS c ON o.customer_id=c.id \WHERE c.id=1;"};letpostdata=async()=>{constresponse=awaitfetch('http://127.0.0.1/api',{method:'POST',//...snip...body:JSON.stringify(query)});returnresponse.json();}
response.json would be:
[{"customer":"Bran Oldy","book":"Take Me With You","subtotal":1.98,"order_id":1},
{"customer":"Bran Oldy","book":"Secrets of a Charmed Life","subtotal":3.2,"order_id":1},
{"customer":"Bran Oldy","book":"The Way We Fall","subtotal":18.1,"order_id":6},
{"customer":"Bran Oldy","book":"The Girl on the Train","subtotal":99,"order_id":9,6},
{"customer":"Bran Oldy","book":"Secrets of a Charmed Life","subtotal":6.4,"order_id":12},
{"customer":"Bran Oldy","book":"Steelheart","subtotal":5.0,"order_id":12},
{"customer":"Bran Oldy","book":"Steelheart","subtotal":5.0,"order_id":15}]
I think it is useful for development.
Please consider it.
The text was updated successfully, but these errors were encountered:
POST have to create a new row (= change a data). So GET is more appropriate verb for it.
But I'm not sure why it can be usefull. Typically API don't allow to execute an arbitrary queries.
I think this REST server is for development so it is useful on early stage of prototype development (yet appropriate query is not defined). And does this REST server support GET with request body? Typical GET is not for complex query.
Hi,
POST with query like as
response.json would be:
I think it is useful for development.
Please consider it.
The text was updated successfully, but these errors were encountered: