英文:
Nuxt3; Files uploaded and stored in public folder cannot be found even though other ones can
问题
I am using nuxt 3 to create a web app where users can upload files. For now, I store them in the public folder where I assumed they would get served to users.
Other files like favicon get served but not the uploaded files, I get a 404 error, during yarn dev
it seems to work fine but not after building with yarn build
. this is screenshot of the folder the favicon.ico, can be accessed but not the newly uploaded screenshot. How can I mitigate this?
Full project - https://github.com/kgarchie/Ticketer
I tried searching online, but I can't seem to find a solution.
英文:
I am using nuxt 3 to create a web app where users can upload files. For now, I store them in the public folder where I assumed they would get served to users
Other files like favicon get served but not the uploaded files, I get a 404 error, during yarn dev
it seems to work fine but not after building with yarn build
. this is screenshot of the folder the favicon.ico, can be accessed but not the newly uploaded screenshot. How can I mitigate this?
Full project - https://github.com/kgarchie/Ticketer
I tried searching online, but I can't seem to find a solution
答案1
得分: 1
我决定建立一个 API 端点来提供文件,而不是试图让 Nuxt 来提供它们。似乎 public 目录中的文件是静态的,不太可能会改变。
英文:
I resorted to building an api endpoint to serve the files, instead of trying to make nuxt serve them. It seems the files in the public directory are static and not expected to change.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论