aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/router/index.js
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-05-24 10:49:41 +0200
committerHampusM <hampus@hampusmat.com>2021-05-24 10:49:41 +0200
commit518bd58c5aba1a6eaa645074f3ae2d780c45f6dc (patch)
treea99acd3b434422e019bc76064ad0798c8472f07d /src/frontend/router/index.js
parent21e52ba2fa323e8aebf291882083c1eca9f6a5af (diff)
Restructured the whole project & added Nodemon and Concurrently
Diffstat (limited to 'src/frontend/router/index.js')
-rw-r--r--src/frontend/router/index.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/frontend/router/index.js b/src/frontend/router/index.js
new file mode 100644
index 0000000..68762cd
--- /dev/null
+++ b/src/frontend/router/index.js
@@ -0,0 +1,39 @@
+import { createRouter, createWebHistory } from "vue-router";
+import Home from "../views/Home";
+import Repository from "../views/Repository";
+import RepositoryLog from "../views/RepositoryLog";
+import RepositoryCommit from "../views/RepositoryCommit";
+
+const routes = [
+ {
+ name: "Home",
+ path: "/",
+ component: Home
+ },
+ {
+ name: "Repository",
+ path: '/:repo([a-zA-Z0-9\\.\\-_]+)',
+ component: Repository,
+ props: route => ({ repository: route.params.repo }),
+ children: [
+ {
+ name: "Repository Log",
+ path: "log",
+ component: RepositoryLog,
+ },
+ {
+ name: "Commit",
+ path: "log/:commit([a-fA-F0-9]{40}$)",
+ component: RepositoryCommit,
+ props: route => ({ commit: route.params.commit })
+ }
+ ]
+ }
+]
+
+const router = createRouter({
+ history: createWebHistory(process.env.BASE_URL),
+ routes
+});
+
+export default router; \ No newline at end of file