diff --git a/pages/api/v1/navbar.tsx b/pages/api/v1/navbar.tsx new file mode 100644 index 0000000..b667b5d --- /dev/null +++ b/pages/api/v1/navbar.tsx @@ -0,0 +1,15 @@ +import fsPromises from 'fs/promises' +import path from 'path' + +export default async function Navbar(req: any, res: any) { + try { + const filePath = path.join(process.cwd(), '/public/data/navbar.json') + const jsonData = await fsPromises.readFile(filePath) + const data = JSON.parse(jsonData.toString()) + res.status(200).json(data) + } + catch (error) { + console.log(error) + res.status(500).json({error: 'Error reading data'}) + } +} \ No newline at end of file diff --git a/pages/api/v1/themes.tsx b/pages/api/v1/themes.tsx new file mode 100644 index 0000000..b19723c --- /dev/null +++ b/pages/api/v1/themes.tsx @@ -0,0 +1,15 @@ +import fsPromises from 'fs/promises' +import path from 'path' + +export default async function Navbar(req: any, res: any) { + try { + const filePath = path.join(process.cwd(), '/public/data/themes.json') + const jsonData = await fsPromises.readFile(filePath) + const data = JSON.parse(jsonData.toString()) + res.status(200).json(data) + } + catch (error) { + console.log(error) + res.status(500).json({error: 'Error reading data'}) + } +} \ No newline at end of file diff --git a/public/data/navbar.json b/public/data/navbar.json new file mode 100644 index 0000000..613e960 --- /dev/null +++ b/public/data/navbar.json @@ -0,0 +1,20 @@ +{ + "links": [ + { + "name": "Home", + "href": "/" + }, + { + "name": "About", + "href": "/about" + }, + { + "name": "Games", + "href": "/games" + }, + { + "name": "Services", + "href": "/services" + } + ] +} \ No newline at end of file diff --git a/public/data/themes.json b/public/data/themes.json new file mode 100644 index 0000000..146375c --- /dev/null +++ b/public/data/themes.json @@ -0,0 +1,52 @@ +{ + "themes": [ + { + "themeName": "Light Theme", + "themeId": 0, + "colors": { + "background": "#ffffff", + "primary": "#00aaff", + "secondary": "#ff5300", + "online": "#00ff00", + "loading": "#ff5300", + "offline": "#ff0000" + } + }, + { + "themeName": "Dark Theme", + "themeId": 1, + "colors": { + "background": "#1f1f1f", + "primary": "#00aaff", + "secondary": "#ff5300", + "online": "#00ff00", + "loading": "#ff5300", + "offline": "#ff0000" + } + }, + { + "themeName": "AMOLED Theme", + "themeId": 2, + "colors": { + "background": "#000000", + "primary": "#00aaff", + "secondary": "#ff5300", + "online": "#00ff00", + "loading": "#ff5300", + "offline": "#ff0000" + } + }, + { + "themeName": "AMOLED Theme 2", + "themeId": 3, + "colors": { + "background": "#000000", + "primary": "#00ffaa", + "secondary": "#aa00ff", + "online": "#00ff00", + "loading": "#ff5300", + "offline": "#ff0000" + } + } + ] +} \ No newline at end of file