From 0ca4cc3bfe7434283f3d30edf10f5fdbf901dd74 Mon Sep 17 00:00:00 2001 From: valere Date: Mon, 28 Oct 2024 13:59:38 +0100 Subject: [PATCH] FEAT: api for playlists v1 --- .gitignore | 1 + server/api/playlists.ts | 21 --------------------- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 server/api/playlists.ts diff --git a/.gitignore b/.gitignore index 48fcd8f..f975615 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ logs .DS_Store .fleet .idea +media diff --git a/server/api/playlists.ts b/server/api/playlists.ts deleted file mode 100644 index e6f325f..0000000 --- a/server/api/playlists.ts +++ /dev/null @@ -1,21 +0,0 @@ -import fs from 'fs' -import path from 'path' - -export default eventHandler(async (event) => { - const directoryPath = path.join(process.cwd(), 'media/files/music') // replace 'your-folder' with the folder you want to list - - try { - // Read the directory contents - const files = await fs.promises.readdir(directoryPath) - - return { - success: true, - files: files.filter(file => !file.startsWith('.')) // optional: exclude unwanted files - } - } catch (error) { - return { - success: false, - error: error.message - } - } -})