I used the following code and found that the sub routes are not nested. What should I do to achieve my goal?
from robyn import Robyn
from robyn import Request, SubRouter
app = Robyn(__file__)
v1 = SubRouter(__name__, prefix="/v1")
@v1.get("/index")
def hello_v1(request: Request):
"""
Expected routing: /v1/index
Actual routing: /v1/index
"""
print(request)
return "Hello /v1/index!"
hello = SubRouter(__name__, prefix="/hello")
@hello.get("/index")
def hello_v2(request: Request):
"""
Expected routing: /v1/hello/index
Actual routing: /hello/index
"""
print(request)
return "Hello /v1/hello/index"
word = SubRouter(__name__, prefix="/word")
@word.get("/index")
def hello_v3(request: Request):
"""
Expected routing: /v1/word/index
Actual routing: /word/index
"""
print(request)
return "Hello /v1/word/index"
hello.include_router(word)
v1.include_router(hello)
v1.include_router(word)
app.include_router(v1)
if __name__ == "__main__":
app.start(host="127.0.0.1", port=8000)
logger:
INFO:robyn.logger:Added route HttpMethod.GET /v1/index
INFO:robyn.logger:SERVER IS RUNNING IN VERBOSE/DEBUG MODE. Set --log-level to WARN to run in production mode.
INFO:robyn.logger:Added route HttpMethod.GET /hello/index
INFO:robyn.logger:SERVER IS RUNNING IN VERBOSE/DEBUG MODE. Set --log-level to WARN to run in production mode.
INFO:robyn.logger:Added route HttpMethod.GET /word/index
INFO:robyn.logger:Robyn version: 0.56.0
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too