codecontinent / mxjs

Mx.js - Lightweight Node.js based (type-safe) back-end framework
MIT License
1 stars 0 forks source link

[BUG] Gateway (Route) cannot parse extreme depth or multi-level route with params #2

Closed mahabubx7 closed 26 minutes ago

mahabubx7 commented 2 hours ago

[BUG] Gateway (Route) cannot parse extreme depth or multi-level route with params.

Just discovered this today, if I define an endpoint like /api/v1/user/:id/profile/:change/password or /a/:a/b/:b/c/:c/d/:d/e/:e.... something like this. It will not return response as expected. It gives us 404.

Solution => Just read some frameworks like Hono, Adonis.js to find how they manage their router. Then, I found something and going to implement.

mahabubx7 commented 2 hours ago

Latest update

HTTP Call POST /api/v1/post/a/:a/b/:b/c/:c/d/:d/e/:e/f/:f/g/:g/h/:h/i/:i/j/:j/k/:k/l/:l/m/:m/n/:n/o/:o/p/:p/q/:q/r/:r/s/:s/t/:t/u/:u/v/:v/w/:w/x/:x/y/:y/z/:z HTTP/1.1

Response

{
    "params": {
        "a": ":a",
        "b": ":b",
        "c": ":c",
        "d": ":d",
        "e": ":e",
        "f": ":f",
        "g": ":g",
        "h": ":h",
        "i": ":i",
        "j": ":j",
        "k": ":k",
        "l": ":l",
        "m": ":m",
        "n": ":n",
        "o": ":o",
        "p": ":p",
        "q": ":q",
        "r": ":r",
        "s": ":s",
        "t": ":t",
        "u": ":u",
        "v": ":v",
        "w": ":w",
        "x": ":x",
        "y": ":y",
        "z": ":z"
    }
}