Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
added status check route for API
Browse files Browse the repository at this point in the history
  • Loading branch information
kaxada committed Jan 24, 2024
1 parent ff0d4c6 commit 12300ed
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ app.use((req, res, next) => {
next();
});

app.get("/status", (req, res) => {
try {
res.json({ message: "Event Badging Bot 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.post("/", async (req, res) => {
const {
headers: { "x-github-event": name },
Expand Down

0 comments on commit 12300ed

Please sign in to comment.