Skip to content

Commit

Permalink
added home route to confirm api status on ping
Browse files Browse the repository at this point in the history
  • Loading branch information
kaxada committed Dec 14, 2023
1 parent 7cdb82b commit a84ebc5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ jobs:
--env-file /home/${{ secrets.USERNAME }}/.env \
--restart=always \
--name ${{ env.IMAGE_NAME }} \
${{ env.IMAGE_NAME }}:${{ github.sha }}
${{ env.IMAGE_NAME }}:${{ github.sha }}
25 changes: 25 additions & 0 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,31 @@ const badgedRepos = async (req, res) => {
};

const setupRoutes = (app) => {
app.get("/api", (req, res) => {
try {
res.json({ message: "Project Badging server up and running" });
} catch (error) {
console.error(error);

if (error.statusCode && error.statusCode !== 200) {
res
.status(error.statusCode)
.json({
error: "Error",
message:
"our bad, something is wrong with the server configuration",
});
} else {
res
.status(500)
.json({
error: "Internal Server Error",
message: "An unexpected error occurred at our end",
});
}
}
});

app.get("/api/auth/github", (req, res) => {
githubAuth(req, res);
});
Expand Down

0 comments on commit a84ebc5

Please sign in to comment.