Whenever I place a file in the "public" directory of my express folder, it automatically generates a link on my webpage. For instance, by navigating to , I can download an image. Similarly, clicking on allows me to access a JSON file without any additional steps other than placing the files in the public folder. This feature is incredibly convenient as it saves time and effort, especially when the server needs to handle various items that are subject to frequent modifications.
I am interested in customizing the server command so that instead of immediate downloads, images will be displayed directly within the browser window after adjusting their format using <html> </html>
. Additionally, I would like JSON files to be parsed into a readable layout (JSON.stringify(object,null,2)) for easier comprehension and usage.
Essentially, my goal is to effortlessly upload content to the public folder and have instant access to it in a user-friendly manner based on its file extension. For image files, this means viewing them in-browser, while JSON files should be presented in a structured format for better readability.