I created a registration form that gets data from the user and their profile picture and stores the image into a public folder in my server. The path structure is server/public/avatar but the problem is express.static doesn't work for me, it gives me the error of Connot Get I have tried this syntax app.use(express.static('public')); = doesn't work app.use(express.static(path.join(__dirname, 'public'))); = does not work app.use('/avatar',express.static(path.join(__dirname, '../public/avatar'))); = not working app.use('/avatar',express.static(path.join(_dirname '../public/avatar'))); = not working This is my API http://localhost:3001/avatar/avatar_url.jpg Please help me solve my problem, I'm very new to Nodejs and React
I want to get the user's profile picture and use the mapping function to display their profile into my react, here is my code to get the profile picture in the react http://localhost:3001 /avatar/${value?.avatar_url}}/> {value.first_name} {value.last_name}
I solved my problem, I just added this code app.use(express.static('public')); to my index.js file