| const express = require('express'); | |
| const path = require('path'); | |
| const app = express(); | |
| const port = 9999; | |
| const dirToJson = require('dir-to-json'); | |
| // Set up the input directory path and serve it | |
| const inputDirectoryPath = path.join('/work/Ace_ComfyUI/input'); | |
| app.use('/files', (req, res) => { | |
| Promise.all([ | |
| dirToJson("/work/Ace_ComfyUI/input"), | |
| dirToJson("/work/Ace_ComfyUI/output") | |
| ]).then(([inputStructure, outputStructure]) => { | |
| res.json({ | |
| 'Input': inputStructure, | |
| 'Output': outputStructure | |
| }); | |
| }).catch(error => { | |
| res.status(500).send('Could not read directory structure'); | |
| }); | |
| }); | |
| // Start the server | |
| app.listen(port, () => { | |
| console.log(`File manager running at http://localhost:${port}`); | |
| }); | |