How to get an image from the backend to the frontend, the image is saved in /public/uploads, I have already installed @fastify/static but my route is 404, below is the code snippet.
app.register(fastifyStatic, {
root: path.join(__dirname, 'public/'),
prefix: '/uploads'
})
app.get('/another/path', async function (req, reply){
return reply.sendFile('image.jpeg')
})
How to access images in the frontend
vinnycosta1998 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.