[Vuejs]-Blob Objects sent through Axios are empty in Express

0👍

add HTTP headers with Axios request

axios.post(`http://localhost:3000/blob`,
{ "blob": this.blobObject },
{ 
 headers: {'Content-Type':'application/json'}
})
.then(
     (response) => {
          console.log('Successfully Save API')
     },
     (err) => {
          console.error(err)
     }
)

and make sure you have JSON parser middleware eg (if an app is your express app)

app.use(express.json());

Leave a comment