我想知道你是否能在这件事上帮助我。
调用函数:
function apiCreate(url, product) {
console.log('Posting request API...' + JSON.stringify(product) );
fetch(url, {
dataType: 'json',
method: 'post',
body: product
}).then(function(response) {
console.log("we did it")
return response.json();
}).then(function(data) {
console.log('Created Gist:', data.html_url);
});
接收的是:
router.post('/create', (req, res) => {
console.log('catalog product create Called.');
console.log('addProduct Called..');
console.log('req: '+ JSON.stringify(req.body));
我可以到达终点,但主体不在“req”对象中。
跃然一笑
相关分类