diff options
| author | Alex Pooley <zuedev@gmail.com> | 2025-03-19 05:14:20 +0000 |
|---|---|---|
| committer | Alex Pooley <zuedev@gmail.com> | 2025-03-19 05:14:20 +0000 |
| commit | be2ac5fe4a0d0b87ebe12853a1dd8b459ce369c1 (patch) | |
| tree | 70b171a51b4193274386526f1fb8fff214b56011 /source/index.js | |
| parent | a23540112583436b242307a229691b6a5beded71 (diff) | |
| download | zue.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/index.js')
| -rw-r--r-- | source/index.js | 16 |
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", }); }); |
