Home > Blockchain >  How can I bring a HTML Image to the backend?
How can I bring a HTML Image to the backend?

Time:08-24

I have a middleware:

export async function imageTagging(image){
    console.log(image)
    const response = await axios.get('/api/tensorflow', {
        image: image
    });
    return response.data[0];
}

which logs me (image):

<img data-v-713aaf8f="" id="MLIMAGE" src="/img/Erdmännchen.b5f674c2.jpg" width="50%" crossorigin="anonymous"  style="border-style: solid;">

my API-Call in the backend looks like:

 app.get('/api/tensorflow', userMiddleware.isLoggedIn, (req, res) => {
  console.log(req.query);
  console.log(res.query);
})

it logs me:

{}
undefined

CodePudding user response:

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?

  • Related