Search code examples
expressstaticfilesystemsvercelnuxt3.js

How to access filesystem/static files in a nuxt3 api in vercel using nodejs path/fs modules


I'm using vercel for hosting my nuxt3 app, it has few APIs and I want to access files stored in my src/public directory using filesystem / node APIs

I tried using path and fs modules and listing out the directories but I was not able to find my assets in public folder


Solution

  • This is an antipattern of serverless architecture, vercel does not host the serverless functions and static assets together, hence accessing static files from the filesystem is not possible, but in order to store the data, vercel has many services/products, vercel blob and other products solved this issue