aboutsummaryrefslogtreecommitdiff
path: root/api/v1.js
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-05-19 15:59:12 +0200
committerHampusM <hampus@hampusmat.com>2021-05-19 15:59:12 +0200
commite82d9498d836ea100a186c4d87a7d0314ec1693a (patch)
treee48f2c7a230aafe6ff91ade54cdee8fad7ec2986 /api/v1.js
parentfcc482fd61077a6af6cd9fcfad6f75c72aa59355 (diff)
Backend uses nodegit, gettings repos is a single function & backend cleaned up
Diffstat (limited to 'api/v1.js')
-rw-r--r--api/v1.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/api/v1.js b/api/v1.js
index 4987ba7..7920afc 100644
--- a/api/v1.js
+++ b/api/v1.js
@@ -12,15 +12,13 @@ router.get("/info", function(req, res)
router.get("/repos", async function(req, res)
{
- let repo_dirs = await git.getRepos(req.settings["base_dir"]);
+ let repos = await git.getRepos(req.settings["base_dir"]);
- if(repo_dirs["error"]) {
+ if(repos["error"]) {
res.status(500).send("Internal server error!");
return;
}
- repo_dirs = repo_dirs["data"].filter(repo => repo.endsWith(".git"));
- const repos = await git.getBasicRepoInfo(req.settings["base_dir"], repo_dirs);
res.json({ "data": repos });
});
@@ -58,7 +56,7 @@ router.get("/repos/:repo/log", async function(req, res)
}
return;
}
- res.json(log);
+ res.json({ data: log });
});
router.get("/repos/:repo/log/:commit", async function(req, res)
@@ -70,7 +68,7 @@ router.get("/repos/:repo/log/:commit", async function(req, res)
const commit = await git.getCommit(req.settings["base_dir"], req.params.repo, req.params.commit);
- res.json(commit);
+ res.json({ data: commit });
});
module.exports = router; \ No newline at end of file