1 回答

TA貢獻1826條經驗 獲得超6個贊
缺少標題,試試這個..
function apiCreate(url, product) {
try {
fetch(url, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(product)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.log(error))
} catch (err) {
console.log(err)
}
}
接收...
router.post('/create', (req, res) => {
console.log('catalog product create Called.');
console.log('addProduct Called..');
console.log(`req ${body.req}`);
添加回答
舉報