DNY client (11 – Profile Photo Display)

Server side

First we put in the route

routes/user.js

Then we implement the function responder for when the user goes to /user/photo/:userId

Since we already retrieved the user object at function userById, everything is already in req.profile
We simply check for the image data, and then set the content type.

controllers/user.js

Client Side

we create a photoUrl so that our image control has a src.

src/user/EditProfile.js

However, there is an issue. The browser cache images and when you try to upload another image, and you come back to this page, the browser will be showing the old image.

In this situation, simply give the latest time and append it to the URL