node async await with sequlize not working properly?
have made an api to upload my in image into cloudinary and also save the image path in the database.but i'm getting the following error:- Sequelize database error (as null error is sent in the place of image) and here is the following code i'm using:-
router.post('/upload',upload.single('image'),async(req,res)=>{ const image = await cloudinary.v2.uploader.upload(req.file.path).secure_url;
Image.create({ image }).then(result=>{ res.status(200).json({ message:'Image saved' }); }).catch(err=>{ res.status(403).json({ message:'error occured', error:err }); }); });
how can improve in the sequelize section in order to save the data in the database ?