aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAlex Pooley <zuedev@gmail.com>2025-03-19 05:14:20 +0000
committerAlex Pooley <zuedev@gmail.com>2025-03-19 05:14:20 +0000
commitbe2ac5fe4a0d0b87ebe12853a1dd8b459ce369c1 (patch)
tree70b171a51b4193274386526f1fb8fff214b56011 /source
parenta23540112583436b242307a229691b6a5beded71 (diff)
downloadzue.dev-be2ac5fe4a0d0b87ebe12853a1dd8b459ce369c1.tar
zue.dev-be2ac5fe4a0d0b87ebe12853a1dd8b459ce369c1.tar.gz
zue.dev-be2ac5fe4a0d0b87ebe12853a1dd8b459ce369c1.tar.bz2
zue.dev-be2ac5fe4a0d0b87ebe12853a1dd8b459ce369c1.tar.xz
zue.dev-be2ac5fe4a0d0b87ebe12853a1dd8b459ce369c1.zip
refactor: rename context variable for clarity in route handlers
Diffstat (limited to 'source')
-rw-r--r--source/index.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/source/index.js b/source/index.js
index c20041b..5fe6c8b 100644
--- a/source/index.js
+++ b/source/index.js
@@ -7,22 +7,22 @@ const app = new Hono();
app.use("*", cors());
// return a simple message
-app.get("/", (c) => {
- return c.json({
+app.get("/", (context) => {
+ return context.json({
message: "Hello, World! :3",
});
});
// return own status of the server
-app.get("/status", (c) => {
- return c.json({
+app.get("/status", (context) => {
+ return context.json({
status: "ok",
});
});
// return status of a given service
-app.get("/status/:service", (c) => {
- const { service } = c.req.param();
+app.get("/status/:service", (context) => {
+ const { service } = context.req.param();
const acceptedServices = [
"dns",
@@ -44,7 +44,7 @@ app.get("/status/:service", (c) => {
];
if (!acceptedServices.includes(service)) {
- return c.json(
+ return context.json(
{
error: "unknown service",
},
@@ -52,7 +52,7 @@ app.get("/status/:service", (c) => {
);
}
- return c.json({
+ return context.json({
status: "ok",
});
});