Hi, Every One. I have some problem while upload and view images in next.js app.
I upload images to %project%/public/uploads folder
after upload, I can't load uploaded image in next.js app.
when I run the app with dev it works well.
but I run the app with prod it doesn't works.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (1)
This was because of server.
I found the answer.
`app.prepare().then(() => {
const server = express();
// server.use(fileUpload())
server.use("/upload", express.static(__dirname + "/public/uploads"));
server.all("*", (req, res) => {
return handle(req, res);
});
server.listen(port, (err) => {
if (err) throw err;`
and use /upload/image_path