diff --git a/src/frontend/errors/dbError.eta.html b/src/frontend/errors/dbError.eta.html
index 3cd0e4a..84723c1 100644
--- a/src/frontend/errors/dbError.eta.html
+++ b/src/frontend/errors/dbError.eta.html
@@ -3,7 +3,7 @@
diff --git a/src/frontend/categoryManager.eta.html b/src/frontend/manage/categoryManager.eta.html
similarity index 93%
rename from src/frontend/categoryManager.eta.html
rename to src/frontend/manage/categoryManager.eta.html
index c3626e9..a8cf0c3 100644
--- a/src/frontend/categoryManager.eta.html
+++ b/src/frontend/manage/categoryManager.eta.html
@@ -1,4 +1,4 @@
-<%~ E.includeFile("partials/head.eta.html", {"title": "Settings - Category"}) %> <%~ E.includeFile("partials/controls.eta.html", {"active": "SETT_CAT"}) %>
+<%~ E.includeFile("../partials/head.eta.html", {"title": "Settings - Category"}) %> <%~ E.includeFile("../partials/controls.eta.html", {"active": "SETT_CAT"}) %>
All categories
@@ -97,4 +97,4 @@
-<%~ E.includeFile("partials/controlsFoot.eta.html") %> <%~ E.includeFile("partials/foot.eta.html") %>
+<%~ E.includeFile("../partials/controlsFoot.eta.html") %> <%~ E.includeFile("../partials/foot.eta.html") %>
diff --git a/src/frontend/imports/csvImport.eta.html b/src/frontend/manage/imports/csvImport.eta.html
similarity index 70%
rename from src/frontend/imports/csvImport.eta.html
rename to src/frontend/manage/imports/csvImport.eta.html
index 123eb0f..98990f0 100644
--- a/src/frontend/imports/csvImport.eta.html
+++ b/src/frontend/manage/imports/csvImport.eta.html
@@ -1,5 +1,5 @@
-<%~ E.includeFile("../partials/head.eta.html", {"title": "Importer - CSV" }) %>
- <%~ E.includeFile("../partials/controls.eta.html", {"active": "CSV_import" }) %>
+<%~ E.includeFile("../../partials/head.eta.html", {"title": "Importer - CSV" }) %>
+ <%~ E.includeFile("../../partials/controls.eta.html", {"active": "CSV_import" }) %>
Import A CSV File
Upload a CSV file to import into the database. The CSV file must have the following columns:
@@ -24,5 +24,5 @@
- <%~ E.includeFile("../partials/controlsFoot.eta.html") %>
- <%~ E.includeFile("../partials/foot.eta.html") %>
\ No newline at end of file
+ <%~ E.includeFile("../../partials/controlsFoot.eta.html") %>
+ <%~ E.includeFile("../../partials/foot.eta.html") %>
\ No newline at end of file
diff --git a/src/frontend/partials/controls.eta.html b/src/frontend/partials/controls.eta.html
index e7b4282..b10d089 100644
--- a/src/frontend/partials/controls.eta.html
+++ b/src/frontend/partials/controls.eta.html
@@ -65,7 +65,7 @@
Dashboard
- All Items
+ All Items
Products
@@ -87,19 +87,18 @@
diff --git a/src/routes/api/index.ts b/src/routes/api/index.ts
index f4603a1..6528ca2 100644
--- a/src/routes/api/index.ts
+++ b/src/routes/api/index.ts
@@ -1,11 +1,11 @@
import express from 'express';
// Route imports
-import testRoute from './test.js';
+import v1_routes from './v1/index.js';
// Router base is '/api'
-const Router = express.Router();
+const Router = express.Router({ strict: false });
-Router.use('/test', testRoute);
+Router.use('/v1', v1_routes);
export default Router;
diff --git a/src/routes/api/v1/index.ts b/src/routes/api/v1/index.ts
new file mode 100644
index 0000000..fa9e93c
--- /dev/null
+++ b/src/routes/api/v1/index.ts
@@ -0,0 +1,11 @@
+import express from 'express';
+
+// Route imports
+import testRoute from './test.js';
+
+// Router base is '/api/v1'
+const Router = express.Router({ strict: false });
+
+Router.use('/test', testRoute);
+
+export default Router;
diff --git a/src/routes/api/test.ts b/src/routes/api/v1/test.ts
similarity index 68%
rename from src/routes/api/test.ts
rename to src/routes/api/v1/test.ts
index 4490bdf..03da78d 100644
--- a/src/routes/api/test.ts
+++ b/src/routes/api/v1/test.ts
@@ -1,5 +1,5 @@
import express, { Request, Response } from 'express';
export default (req: Request, res: Response) => {
- res.status(200).send('API Test Successful!');
+ res.status(200).send('API v1 Test Successful!');
};
diff --git a/src/routes/frontend/index.ts b/src/routes/frontend/index.ts
index f5bf2e5..afef15c 100644
--- a/src/routes/frontend/index.ts
+++ b/src/routes/frontend/index.ts
@@ -4,19 +4,16 @@ import express from 'express';
import skuRoute from './:id.js';
import testRoute from './test.js';
import dashboardRoute from './dashboard.js';
-import csvImportRoute from './import/csvImport.js';
-import listAllItems from './listAllItems.js';
-import categoryManager from './categoryManager.js';
+import itemsRoute from './items.js';
+import manage_routes from "./manage/index.js";
// Router base is '/'
const Router = express.Router({ strict: false });
-
Router.use('/test', testRoute);
-Router.use('/allItems', listAllItems)
-Router.use('/allCategories', categoryManager)
-Router.use('/import/csv', csvImportRoute);
+Router.use('/items', itemsRoute)
Router.use('/:id(\\w{8})', skuRoute);
+Router.use('/manage', manage_routes);
Router.use('/', dashboardRoute);
export default Router;
diff --git a/src/routes/frontend/listAllItems.ts b/src/routes/frontend/items.ts
similarity index 100%
rename from src/routes/frontend/listAllItems.ts
rename to src/routes/frontend/items.ts
diff --git a/src/routes/frontend/categoryManager.ts b/src/routes/frontend/manage/categoryManager.ts
similarity index 91%
rename from src/routes/frontend/categoryManager.ts
rename to src/routes/frontend/manage/categoryManager.ts
index 207336a..6150940 100644
--- a/src/routes/frontend/categoryManager.ts
+++ b/src/routes/frontend/manage/categoryManager.ts
@@ -1,5 +1,5 @@
import express, { Request, Response } from 'express';
-import { prisma, __path, log } from '../../index.js';
+import { prisma, __path, log } from '../../../index.js';
export default (req: Request, res: Response) => {
// If method is get, render the page
@@ -9,7 +9,7 @@ export default (req: Request, res: Response) => {
.findMany({})
.then((items) => {
// Count amount of total items
- res.render(__path + '/src/frontend/categoryManager.eta.html', { items: items });
+ res.render(__path + '/src/frontend/manage/categoryManager.eta.html', { items: items });
})
.catch((err) => {
console.error(err);
diff --git a/src/routes/frontend/import/csvImport.ts b/src/routes/frontend/manage/import/csvImport.ts
similarity index 94%
rename from src/routes/frontend/import/csvImport.ts
rename to src/routes/frontend/manage/import/csvImport.ts
index 853f840..c301e28 100644
--- a/src/routes/frontend/import/csvImport.ts
+++ b/src/routes/frontend/manage/import/csvImport.ts
@@ -1,5 +1,5 @@
import express, { Request, Response } from 'express';
-import { prisma, __path, log } from '../../../index.js';
+import { prisma, __path, log } from '../../../../index.js';
import { UploadedFile } from 'express-fileupload';
import { parse, transform } from 'csv';
import { Status, Category, PrismaPromise } from '@prisma/client';
@@ -96,7 +96,7 @@ export default (req: Request, res: Response) => {
} else {
// Render page
- res.render(__path + '/src/frontend/imports/csvImport.eta.html');
+ res.render(__path + '/src/frontend/manage/imports/csvImport.eta.html');
}
};
\ No newline at end of file
diff --git a/src/routes/frontend/manage/index.ts b/src/routes/frontend/manage/index.ts
new file mode 100644
index 0000000..72f9ec6
--- /dev/null
+++ b/src/routes/frontend/manage/index.ts
@@ -0,0 +1,15 @@
+import express from 'express';
+
+// Route imports
+import testRoute from './test.js';
+import csvImportRoute from './import/csvImport.js';
+import categoryManager from './categoryManager.js';
+
+// Router base is '/manage'
+const Router = express.Router({ strict: false });
+
+Router.use('/test', testRoute);
+Router.use('/categories', categoryManager)
+Router.use('/import/csv', csvImportRoute);
+
+export default Router;
diff --git a/src/routes/frontend/manage/test.ts b/src/routes/frontend/manage/test.ts
new file mode 100644
index 0000000..4e19628
--- /dev/null
+++ b/src/routes/frontend/manage/test.ts
@@ -0,0 +1,4 @@
+import express, { Request, Response } from 'express';
+export default (req: Request, res: Response) => {
+ res.status(200).send('Manage Test Successful!');
+};
diff --git a/src/routes/index.ts b/src/routes/index.ts
index 69bc8b3..1772a54 100644
--- a/src/routes/index.ts
+++ b/src/routes/index.ts
@@ -10,7 +10,7 @@ const Router = express.Router({ strict: false });
Router.use('/static', static_routes);
Router.use('/api', api_routes);
-Router.use('/dev', dev_routes); // This is just for development. ToDo: Add check if we are in devmode.
+Router.use('/dev', dev_routes); // This is just for development. TODO: Add check if we are in devmode.
Router.use('/', frontend_routes);
export default Router;
\ No newline at end of file