Browse Source

Refactored /repositories/:name route

pull/28/head
Peter Morgan 5 years ago
parent
commit
31d865526e
1 changed files with 9 additions and 12 deletions
  1. +9
    -12
      routes/api/v2.js

+ 9
- 12
routes/api/v2.js View File

@ -253,18 +253,15 @@ routes.get("/org/users/:name", async (request, res) => {
});
routes.get("/repositories/:name", (request, result)=>
{
queryRepositories(request.params.name, API_USER_PATH).then(repos=>
{
result.json(repos)
.end();
}).catch(error=>
{
result.status(500)
.json({error: 'API error fetching friends'})
.end();
});
routes.get("/repositories/:name", async (req, res) => {
try {
const repos = await queryRepositories(req.params.name, API_USER_PATH);
res.json(repos).end();
} catch (error) {
res.status(500)
.json({error: 'API error fetching friends'})
.end();
}
});

Loading…
Cancel
Save