2

I have this db.json

{
 "id": 1,
 "products": [
   {
    "product": {
    "id": 1,
    "name": "bibibii",
    "qty": 2,
    "price": 20
   }
 }
],
"total": 0
}

And I want to access to the "product" object. I'm making a shopping cart with json-server, and I need to post new products inside the product object...

So, to access the data I've tried http://localhost:3000/cart/1_embed=products but "_embed" do not work.

Thank you for your help !

1 Answer 1

1

You have typos error in your url. You must embed with ?

The correct pattern for json-server is: http://localhost:3000/cart/1?_embed=products

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.