2
我有這樣的代碼在這裏:爲什麼需要和fs.existSync使用不同的相對路徑
if(fs.existsSync('./example/example.js')){
cb(require('../example/example.js'));
}else{
cb();
}
爲什麼要fs.existSync
是使用不同的目錄require
?
這將是不包括的東西不需要目錄樹......(我用快遞BTW)
\example
example.js
\routes
index.js <-- this is the one where I am using this code
app.js <-- this one requires index.js and calls its functions using app.get('/example',example.index);
我不明白'接近'票,我認爲這是一個適當的問題。 – robertklep
這是一個正確的問題-.- – FabianCook