'Is that posssible to post method use in 2 server side url
I added a form and from this value all I set in const then post in API express js server with MongoDB how can I post method use post in 2url
const handleSubmit = (event) => {
event.preventDefault();
const name = event.target.name.value
const price = event.target.price.value
const quantity = event.target.quantity.value
const supplier = event.target.supplier.value
const description = event.target.description.value
const img = event.target.img.value
fetch('http://localhost:5000/computer/', {
method: 'POST',
body: JSON.stringify({
name: name,
price: price,
quantity: quantity,
supplier: supplier,
description: description,
img: img,
email: user.email
}),
headers: {
// 'authorization': `${user.email} ${localStorage.getItem("accssToken")}`,
'Content-type': 'application/json; charset=UTF-8',
},
})
.then((response) => response.json())
.then((json) => console.log(json));
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
