Hi, I am a beginner in node. Recently I started building a website where signed in users can upload images. I use multer for that, I also set the max file size to 5 MB. When the file size is bigger than that multer throws an error. I tried doing some error handling (I am completely new to this). I built this simple middleware function:function error(err, req, res, next){ res.json({ message: err.message }) } This works but the problem is that when the error occurs this json data is displayed in the browser window:{"message":"File too large"}What I want to do is refresh the whole page with the error message displayed somewhere on my page. How can I do that? Also could someone please explain how error handling works cause i am very confused?Thanks in advance :)
Submitted July 28, 2018 at 07:52PM by everek123
No comments:
Post a Comment