Replies: 2 comments 3 replies
-
I tried a similar case and got the following error. The problem arises here.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
It works if. import { Hono } from "https://deno.land/x/hono/mod.ts";
import { serve } from "https://deno.land/std/http/mod.ts";
const app = new Hono();
- app.get("/api/animal/:type{(c.+)?}/show", (c) =>
+ app.get("/api/animal/:type{c.+?}/show", (c) =>
c.text("Animal!" + JSON.stringify(c.req.param()))
);
serve(app.fetch); |
Beta Was this translation helpful? Give feedback.
3 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
I'd like to express something like: an optional "type" parameter can be supplied, if it starts with "c".
Things I've tried:
I get "Internal Server Error" for any regex involving
(
, which also prevents me from expressing a required path segment like(a|b)
:Am I doing something wrong? Is it possible to express optional-regex-backed path segments? Is it possible to express required-regex-backed path segments that include parens in the regex?
Beta Was this translation helpful? Give feedback.
All reactions