I have the following bit of code on a view
var fd = new FormData();
fd.append("hello", "world");
fetch('/vision', {
method: 'post',
"content-type": "application/json; charset=utf-8",
body: JSON.stringify({
hello: "world"
})
})
.then(data => {
debugger;
})
and the action to handle
visionRouter.post("/", (req, res) => {
vision.detectText(imageUrl, (err, text) => {
res.send(text);
})
});
The route is getting hit, but req.body
doesn't exist. How can you use fetch and FormData with express?
via Mega Man
No comments:
Post a Comment