I have a middleware:
JavaScript
x
8
1
export async function imageTagging(image){
2
console.log(image)
3
const response = await axios.get('/api/tensorflow', {
4
image: image
5
});
6
return response.data[0];
7
}
8
which logs me (image):
JavaScript
1
2
1
<img data-v-713aaf8f="" id="MLIMAGE" src="/img/Erdmännchen.b5f674c2.jpg" width="50%" crossorigin="anonymous" class="card-img-top embed-responsive-item" style="border-style: solid;">
2
my API-Call in the backend looks like:
JavaScript
1
5
1
app.get('/api/tensorflow', userMiddleware.isLoggedIn, (req, res) => {
2
console.log(req.query);
3
console.log(res.query);
4
})
5
it logs me:
JavaScript
1
3
1
{}
2
undefined
3
Advertisement
Answer
First of all, you are doing a GET request. You can’t post data to a /GET endpoint. You need a /POST.
Secondly, req.query
is an object of key-value pairs of query parameters, which in your case is rightfully empty. So I don’t understand, what is your exact question?