简体   繁体   中英

How can I bring a HTML Image to the backend?

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" class="card-img-top embed-responsive-item" 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

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM