Actually when i tried to add image on localhost (on my machine) it is adding images to public/assests folder and showing those images but images are not adding or showing when i hosted it on render
app.use("/assets", express.static(path.join(\__dirname, "public/assets")));
const storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, "public/assets");
},
filename: function (req, file, cb) {
cb(null, file.originalname);
},
});
const upload = multer({ storage });
app.post("/auth/register", upload.single("picture"), register);
If you are using jade add the image to the HTML like this,
img(src='/assets/Screenshot 2024-02-11 003339.png', alt='Image')