diff --git a/docs/DATAFLOW.md b/docs/DATAFLOW.md new file mode 100644 index 0000000..4732a1f --- /dev/null +++ b/docs/DATAFLOW.md @@ -0,0 +1,41 @@ +# Routes Scratchpad + +```mermaid + graph TD + + input + output + + subgraph jason + inSEvent + inSGenre + inDDate + appApp + appOut + end + + subgraph tanya + toOpenAI + fromOpenAI + end + + openai + + subgraph gaj + toSpotify + fromSpotify + end + + spotify + + input --> inSEvent & inSGenre & inDDate + inSEvent & inSGenre --> toOpenAI + toOpenAI --> openai + openai --> fromOpenAI + inDDate & fromOpenAI --> appApp + appApp --> toSpotify + toSpotify --> spotify + spotify --> fromSpotify + fromSpotify --> appOut + appOut --> output +``` diff --git a/docs/folders b/docs/folders new file mode 100644 index 0000000..d489594 --- /dev/null +++ b/docs/folders @@ -0,0 +1,34 @@ +src +├── app.ts +├── controllers +│ ├── openAI +│ │ └── extractEmotion.ts +│ ├── spotify +│ │ └── searchGenre.ts +│ └── user +│ ├── getInput.ts +│ └── showOutput.ts +├── data +│ ├── demo +│ │ └── album.json +│ └── schema +│ └── categories.json +├── models +│ ├── openai +│ └── spotify +│ └── searchGenre.ts +├── routes +│ ├── internal +│ │ └── user.ts +│ ├── openAI +│ │ └── index.ts +│ ├── routes.ts +│ └── spotify +│ └── index.ts +├── swagger.ts +└── types + ├── openaiQuery.ts + ├── openaiResponse.ts + ├── spotifyQuery.ts + ├── spotifyResponse.ts + └── userInput.ts diff --git a/nodemon.json b/nodemon.json index 502d93b..4cc6d6a 100644 --- a/nodemon.json +++ b/nodemon.json @@ -1,5 +1,5 @@ { "watch": ["src"], "ext": "ts", - "exec": "ts-node --esm -r tsconfig-paths/register ./src/app.ts" + "exec": "tsx src/app.ts" } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 3df8162..f973583 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,11 +12,12 @@ "@spotify/web-api-ts-sdk": "^1.2.0", "dotenv": "^16.4.5", "express": "^4.21.0", + "itty-router": "^5.0.18", "openai": "^4.63.0", "spotify-web-api-node": "^5.0.2", + "prompt-sync": "^4.2.0", "swagger-jsdoc": "^6.2.8", - "swagger-ui-express": "^5.0.1", - "tsx": "^4.19.1" + "swagger-ui-express": "^5.0.1" }, "devDependencies": { "@definitelytyped/dtslint": "^0.2.23", @@ -24,7 +25,8 @@ "@tsconfig/node20": "^20.1.4", "@types/dotenv": "^6.1.1", "@types/express": "^4.17.21", - "@types/node": "^22.5.5", + "@types/node": "^22.7.4", + "@types/prompt-sync": "^4.2.3", "@types/spotify-web-api-node": "^5.0.11", "@types/swagger-jsdoc": "^6.0.4", "@types/swagger-ui-express": "^4.1.6", @@ -34,6 +36,7 @@ "prettier": "^3.3.3", "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", + "tsx": "^4.19.1", "typescript": "^5.6.2", "typescript-eslint": "^8.6.0" } @@ -836,6 +839,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -852,6 +856,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -868,6 +873,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -884,6 +890,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -900,6 +907,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -916,6 +924,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -932,6 +941,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -948,6 +958,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -964,6 +975,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -980,6 +992,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -996,6 +1009,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1012,6 +1026,7 @@ "cpu": [ "loong64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1028,6 +1043,7 @@ "cpu": [ "mips64el" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1044,6 +1060,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1060,6 +1077,7 @@ "cpu": [ "riscv64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1076,6 +1094,7 @@ "cpu": [ "s390x" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1092,6 +1111,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1108,6 +1128,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1124,6 +1145,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1140,6 +1162,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1156,6 +1179,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1172,6 +1196,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1188,6 +1213,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1204,6 +1230,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1507,7 +1534,8 @@ "node_modules/@spotify/web-api-ts-sdk": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@spotify/web-api-ts-sdk/-/web-api-ts-sdk-1.2.0.tgz", - "integrity": "sha512-JUaebva3Ohwo5I5tuTqyW/FKGOMbb40YevJMySAOINRxP7qQ/AMjBzfJx0zeO6yS+wAPfQSoGNsZaUggHw8vsA==" + "integrity": "sha512-JUaebva3Ohwo5I5tuTqyW/FKGOMbb40YevJMySAOINRxP7qQ/AMjBzfJx0zeO6yS+wAPfQSoGNsZaUggHw8vsA==", + "license": "Apache" }, "node_modules/@tsconfig/node10": { "version": "1.0.11", @@ -1629,9 +1657,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.5.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.5.tgz", - "integrity": "sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==", + "version": "22.7.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.4.tgz", + "integrity": "sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==", "license": "MIT", "dependencies": { "undici-types": "~6.19.2" @@ -1661,6 +1689,13 @@ "node": ">= 6" } }, + "node_modules/@types/prompt-sync": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@types/prompt-sync/-/prompt-sync-4.2.3.tgz", + "integrity": "sha512-Ox77gCSx0YyeakGt/qfOZUSFNSSi+sh3ABoGOiCwiO2KODx492BJnUm9oIXS+AHJtqp12iM4RduY6viTJ9bYwA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/qs": { "version": "6.9.16", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.16.tgz", @@ -3241,6 +3276,7 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", + "dev": true, "hasInstallScript": true, "license": "MIT", "bin": { @@ -3887,6 +3923,7 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, "hasInstallScript": true, "license": "MIT", "optional": true, @@ -4050,6 +4087,7 @@ "version": "4.8.1", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.8.1.tgz", "integrity": "sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==", + "dev": true, "license": "MIT", "dependencies": { "resolve-pkg-maps": "^1.0.0" @@ -4773,6 +4811,12 @@ "dev": true, "license": "MIT" }, + "node_modules/itty-router": { + "version": "5.0.18", + "resolved": "https://registry.npmjs.org/itty-router/-/itty-router-5.0.18.tgz", + "integrity": "sha512-mK3ReOt4ARAGy0V0J7uHmArG2USN2x0zprZ+u+YgmeRjXTDbaowDy3kPcsmQY6tH+uHhDgpWit9Vqmv/4rTXwA==", + "license": "MIT" + }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -5711,6 +5755,36 @@ "license": "MIT", "optional": true }, + "node_modules/prompt-sync": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/prompt-sync/-/prompt-sync-4.2.0.tgz", + "integrity": "sha512-BuEzzc5zptP5LsgV5MZETjDaKSWfchl5U9Luiu8SKp7iZWD5tZalOxvNcZRwv+d2phNFr8xlbxmFNcRKfJOzJw==", + "license": "MIT", + "dependencies": { + "strip-ansi": "^5.0.0" + } + }, + "node_modules/prompt-sync/node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/prompt-sync/node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -5946,6 +6020,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, "license": "MIT", "funding": { "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" @@ -6880,6 +6955,7 @@ "version": "4.19.1", "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.1.tgz", "integrity": "sha512-0flMz1lh74BR4wOvBjuh9olbnwqCPc35OOlfyzHba0Dc+QNUeWX/Gq2YTbnwcWPO3BMd8fkzRVrHcsR+a7z7rA==", + "dev": true, "license": "MIT", "dependencies": { "esbuild": "~0.23.0", diff --git a/package.json b/package.json index b7982f2..d2ee46b 100644 --- a/package.json +++ b/package.json @@ -5,11 +5,10 @@ "description": "A thing that will, at some point, do a thing.", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", "dtslint": "dtslint types", "compile": "npx tsc", "server": "node dist/app.js", - "dev": "nodemon" + "dev": "nodemon --exec tsx src/app.ts" }, "keywords": [], "author": "", @@ -20,7 +19,8 @@ "@tsconfig/node20": "^20.1.4", "@types/dotenv": "^6.1.1", "@types/express": "^4.17.21", - "@types/node": "^22.5.5", + "@types/node": "^22.7.4", + "@types/prompt-sync": "^4.2.3", "@types/spotify-web-api-node": "^5.0.11", "@types/swagger-jsdoc": "^6.0.4", "@types/swagger-ui-express": "^4.1.6", @@ -30,6 +30,7 @@ "prettier": "^3.3.3", "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", + "tsx": "^4.19.1", "typescript": "^5.6.2", "typescript-eslint": "^8.6.0" }, @@ -37,10 +38,11 @@ "@spotify/web-api-ts-sdk": "^1.2.0", "dotenv": "^16.4.5", "express": "^4.21.0", + "itty-router": "^5.0.18", "openai": "^4.63.0", "spotify-web-api-node": "^5.0.2", + "prompt-sync": "^4.2.0", "swagger-jsdoc": "^6.2.8", - "swagger-ui-express": "^5.0.1", - "tsx": "^4.19.1" + "swagger-ui-express": "^5.0.1" } } diff --git a/src/app.ts b/src/app.ts index 278164c..3fa6845 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,32 +1,40 @@ -import express, { Express, Request, Response } from 'express'; +//h1 SETUP import * as dotenv from 'dotenv'; +import express, { Request, Response, Router } from 'express'; import swaggerDocs from './swagger.js'; +import { router as hub } from "./routes/routes.js"; +//h2 CONFIG dotenv.config(); - const keys = { port: process.env.PORT }; -const app: Express = express(); - -// Initialize Swagger +const app = express(); +const router = Router(); swaggerDocs(app); -//h1 Routers -console.log(`Now in ./app`); - -app.get('/openai', (req: Request, res: Response) => { - res.send({ message: "Server --> OpenAI" }); +//h1 ACTIVE +app.listen(keys.port, () => { + console.log(`Server Listening on Port ${keys.port}`) }); -app.get('/spotify', (req: Request, res: Response) => { - res.send({ message: "Server --> Spotify" }); -}); +//h2 Routers +app.use('/api', hub); -//h2 Fallback +//h2 Endpoints app.get('/', (req: Request, res: Response) => { - res.send({ message: "Server --> Server" }); + res.send(` +

MoodTime

+

Available Endpoints:

+ + `); }); -//h1 Listeners -app.listen(keys.port, () => { - console.log(`Server running on port ${keys.port}`); -}); \ No newline at end of file +//h1 EXPORT +export { router }; \ No newline at end of file diff --git a/src/controllers/getInput.ts b/src/controllers/getInput.ts new file mode 100644 index 0000000..bc09073 --- /dev/null +++ b/src/controllers/getInput.ts @@ -0,0 +1,27 @@ +import promptSync from 'prompt-sync'; +import { userInput } from "../types/userInput.js"; +const prompt = promptSync(); + +async function userInput() { + const mood: string = prompt(` + Tell me what happened on that date, and how you felt about it. + `); + + const genre: string = prompt(` + What genre of music would you like to feature on this playlist? + `); + + const userInput: userInput = { + eventDescription: mood, + musicGenre: genre, + date: new Date() + }; + + userInput.date.setFullYear(parseInt(await prompt(`Type a 4 digit year`), 10)); + userInput.date.setMonth(parseInt(await prompt(`Type a 2 digit month`), 10)); + userInput.date.setDate(parseInt(await prompt(`Type a 2 digit day`), 10)); + + return userInput; +} + +export { userInput }; \ No newline at end of file diff --git a/src/controllers/index.ts b/src/controllers/index.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/controllers/openAI/index.ts b/src/controllers/openAI/extractEmotion.ts similarity index 97% rename from src/controllers/openAI/index.ts rename to src/controllers/openAI/extractEmotion.ts index 3626fbe..f6dd219 100644 --- a/src/controllers/openAI/index.ts +++ b/src/controllers/openAI/extractEmotion.ts @@ -7,10 +7,7 @@ import { openaiResponse } from "../../types/openaiResponse.js"; dotenv.config(); -// Initialize OpenAI with your API key from the environment variables -const openai = new OpenAI({ - apiKey: process.env.OPENAI_API_KEY, -}); +const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY }); //example const userInput: openaiQuery = { diff --git a/src/controllers/server/index.ts b/src/controllers/server/index.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/routes/playlist/router.ts b/src/controllers/showOutput.ts similarity index 58% rename from src/routes/playlist/router.ts rename to src/controllers/showOutput.ts index b9de0d2..9d372c4 100644 --- a/src/routes/playlist/router.ts +++ b/src/controllers/showOutput.ts @@ -1,6 +1,6 @@ -import { Router, Request, Response } from 'express'; - -const router = Router(); +import express, { Request, Response } from 'express'; +import { searchGenre as generatePlaylist } from './spotify/searchGenre.js'; +const router = express.Router(); /** * @openapi @@ -24,18 +24,13 @@ const router = Router(); * '400': * description: Invalid input */ -router.post('/playlist', async (req: Request, res: Response) => { - // Your implementation to handle the request - // Use your controllers to interact with OpenAI and Spotify APIs - try { - const userInput = req.body; - // Validate userInput based on your interface definitions - // Call your controller function + +function userOutput () {} + +router.get('/playlist', async (req: Request, res: Response) => { + const userInput = req.body; const playlist = await generatePlaylist(userInput); res.status(200).json(playlist); - } catch (error) { - res.status(400).json({ error: error.message }); - } }); -export default router; \ No newline at end of file +export { userOutput }; \ No newline at end of file diff --git a/src/controllers/spotify/index.ts b/src/controllers/spotify/searchGenre.ts similarity index 100% rename from src/controllers/spotify/index.ts rename to src/controllers/spotify/searchGenre.ts diff --git a/src/routes/external/openAI.ts b/src/routes/external/openAI.ts new file mode 100644 index 0000000..39b49b4 --- /dev/null +++ b/src/routes/external/openAI.ts @@ -0,0 +1,21 @@ +//h1 IMPORT +import { Request, Response, Router } from "express"; +// import { extractEmotionFromText as parseMood } from "../../controllers/openAI/extractEmotion.js"; +// import { userInput } from "../../controllers/internal/getInput.js"; + +const router = Router(); + +router.get("/", (req: Request, res: Response) => { + res.json( + { route: "/api/openAI/", message: "openAI Router" } + ); +}); + +/* router.get("/parseMood", async (req: Request, res: Response) => { + const input = await userInput(); + const output = await parseMood(input.eventDescription); + + return output; +}); */ + +export { router }; diff --git a/src/routes/external/spotify.ts b/src/routes/external/spotify.ts new file mode 100644 index 0000000..b90f689 --- /dev/null +++ b/src/routes/external/spotify.ts @@ -0,0 +1,19 @@ +//h1 IMPORT +import { Request, Response, Router } from "express"; +// import { searchGenre } from "../../controllers/spotify/searchGenre.js"; +// import { userInput } from "../../controllers/internal/getInput.js"; + +const router = Router(); + +router.get("/", (req: Request, res: Response) => { + res.json( + { route: "/api/spotify/", message: "Spotify Router" } + ); +}); + +/* router.get("/searchGenre", async (req: Request, res: Response) => { + const input = await userInput(); + const output = await searchGenre(input.musicGenre); +}); */ + +export { router }; diff --git a/src/routes/internal/transfer.ts b/src/routes/internal/transfer.ts new file mode 100644 index 0000000..2e530f1 --- /dev/null +++ b/src/routes/internal/transfer.ts @@ -0,0 +1,14 @@ +//h1 IMPORT +import { Request, Response, Router } from "express"; + +const router = Router(); + +//h1 ACTIVE +router.get('/', (req: Request, res: Response) => { + res.json([ + { route: "/api/transfer/", purpose: "transfer Router" } + ]) +}) + +//h1 EXPORT +export { router }; diff --git a/src/routes/internal/user.ts b/src/routes/internal/user.ts new file mode 100644 index 0000000..aeaabde --- /dev/null +++ b/src/routes/internal/user.ts @@ -0,0 +1,19 @@ +//h1 IMPORT +import { Request, Response, Router } from "express"; +// import { userInput } from "../../controllers/internal/getInput.js"; + +const router = Router(); + +//h1 ACTIVE +router.get("/", (req: Request, res: Response) => { + res.json( + { route: "/api/user/", message: "User Router" } + ); +}); + +/* router.get('/input', (req: Request, res: Response) => {}); */ + +/* router.get('/output', (req: Request, res: Response) => {}); */ + +//h1 EXPORT +export { router }; diff --git a/src/routes/openai/router.ts b/src/routes/openai/router.ts deleted file mode 100644 index a088d14..0000000 --- a/src/routes/openai/router.ts +++ /dev/null @@ -1,9 +0,0 @@ -import express, { Express, Request, Response } from "express"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -const keys = { port: process.env.PORT } -const app: Express = express(); - -console.log(`Now in ./src/routes/openai/router.ts`); \ No newline at end of file diff --git a/src/routes/router.ts b/src/routes/router.ts deleted file mode 100644 index ea33e2b..0000000 --- a/src/routes/router.ts +++ /dev/null @@ -1,11 +0,0 @@ -import express, { Express, Request, Response } from "express"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -const keys = { port: process.env.PORT } -const app: Express = express(); - -//h1 Routers - -console.log(`Now in ./src/routes/router.ts`); \ No newline at end of file diff --git a/src/routes/routes.ts b/src/routes/routes.ts new file mode 100644 index 0000000..ef9be11 --- /dev/null +++ b/src/routes/routes.ts @@ -0,0 +1,22 @@ +//h1 IMPORT +import { Request, Response, Router } from "express"; +import { router as transfer } from "./internal/transfer.js"; +import { router as user } from "./internal/user.js"; +import { router as openAI } from "./external/openAI.js"; +import { router as spotify } from "./external/spotify.js"; + +const router = Router(); + +//h1 Router +router.use('/openAI', openAI); +router.use('/spotify', spotify); +router.use('/user', user); +router.use('/transfer', transfer); + +//h2 Routes +router.get('/', (req: Request, res: Response) => { + res.json({ route: "/api/", message: "Hub Router" }); +}); + +//h1 EXPORT +export { router }; \ No newline at end of file diff --git a/src/routes/server/router.ts b/src/routes/server/router.ts deleted file mode 100644 index b76eba3..0000000 --- a/src/routes/server/router.ts +++ /dev/null @@ -1,9 +0,0 @@ -import express, { Express, Request, Response } from "express"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -const keys = { port: process.env.PORT } -const app: Express = express(); - -console.log(`Now in ./src/routes/server/router.ts`); \ No newline at end of file diff --git a/src/routes/spotify/router.ts b/src/routes/spotify/router.ts deleted file mode 100644 index a10e0e0..0000000 --- a/src/routes/spotify/router.ts +++ /dev/null @@ -1,9 +0,0 @@ -import express, { Express, Request, Response } from "express"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -const keys = { port: process.env.PORT } -const app: Express = express(); - -console.log(`Now in ./src/routes/spotify/router.ts`); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 9de6a27..687f2b4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,18 +1,16 @@ { "compilerOptions": { - "target": "es2016", - "module": "NodeNext", - "moduleResolution": "NodeNext", - // "allowJs": true, - // "checkJs": true, + "target": "ES2020", + "module": "ESNext", + "moduleResolution": "Node", "esModuleInterop": true, "forceConsistentCasingInFileNames": true, - "strict": false, + "strict": true, "skipLibCheck": true, "outDir": "dist", "rootDir": "./src", "resolveJsonModule": true }, "include": ["src"], - "exclude": ["node_modules", "dist", "docs", ".github", ".vscode", ".gitignore", ".prettierrc.json", "eslint.config.mjs", "package-lock.json", "package.json", "README.md"] + "exclude": ["node_modules", "dist"] }