mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Step threough directories
This commit is contained in:
parent
564b83879e
commit
a5a0d9ec78
1 changed files with 23 additions and 2 deletions
|
|
@ -20,7 +20,27 @@ class Listing {
|
|||
async handler (req, res) {
|
||||
// const requestUrl = new URL(req.url, 'https://localhost:3000')
|
||||
|
||||
jsonDirectory = await getJsonDirectory()
|
||||
const directoriestoCheck = [
|
||||
'./',
|
||||
'./.next',
|
||||
'./.next/server',
|
||||
'./.next/server/chunks',
|
||||
'./.next/server/chunks/static'
|
||||
]
|
||||
|
||||
const directoriesLookedIn = {}
|
||||
|
||||
try {
|
||||
for ( const directory of directoriestoCheck ) {
|
||||
const contents = await fs.readdir( directory )
|
||||
|
||||
directoriesLookedIn[directory] = contents
|
||||
}
|
||||
} catch( error ) {
|
||||
console.log('', error)
|
||||
}
|
||||
|
||||
// jsonDirectory = await getJsonDirectory()
|
||||
// console.log('resultInfo', resultInfo)
|
||||
|
||||
// Set JSON Header
|
||||
|
|
@ -28,7 +48,8 @@ class Listing {
|
|||
|
||||
// Repond with JSON Data
|
||||
res.json( {
|
||||
jsonDirectory
|
||||
// jsonDirectory
|
||||
directoriesLookedIn
|
||||
} )
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue