[英]How to store data with nodejs outside of the project folder?
這是因為express
試圖保護您的項目文件不被惡意請求暴露。 默認情況下,您無法訪問項目或其他目錄中的任何文件。 您可以定義一個可以使用express.static
方法訪問的目錄。
這會將一個目錄定義為可以訪問的 static 目錄(參見express.static )。 添加后,您還可以將../../
放在路徑中。 Express 將檢查與您的 static 目錄之一中的名稱匹配的任何文件。
// This would allow the user to access the files in that directory
app.use(express.static('../fileArchive'));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.