diff options
author | HampusM <hampus@hampusmat.com> | 2021-05-19 15:59:12 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-05-19 15:59:12 +0200 |
commit | e82d9498d836ea100a186c4d87a7d0314ec1693a (patch) | |
tree | e48f2c7a230aafe6ff91ade54cdee8fad7ec2986 /api/v1.js | |
parent | fcc482fd61077a6af6cd9fcfad6f75c72aa59355 (diff) |
Backend uses nodegit, gettings repos is a single function & backend cleaned up
Diffstat (limited to 'api/v1.js')
-rw-r--r-- | api/v1.js | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -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 |