javascript – how to implement image upload system with node js?

As a suggestion , I think the best way is to upload your image on an external server and give the link address to database .
but there is other ways that you put images on public\images.. dir (not suggested)

STEPS:
1- use fs or fs-extra and multer to save your image to public\images directory .

2- create database model that contain image data (for example mimType , link address)

3- if you have a external server to upload photos , write the code to upload it (use
axios to send photo) otherwise save the dir address that your image saved in database

to resize the image , I suggest sharp

Read more here: Source link