From d7f0964266170d1070eac9823bbb340e89371282 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 19 Jun 2024 22:36:31 -0400 Subject: [PATCH] Fix routes (#3790) --- server.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index 59090258..30ea90c6 100644 --- a/server.py +++ b/server.py @@ -538,8 +538,10 @@ class PromptServer(): # prefix are supported. api_routes = web.RouteTableDef() for route in self.routes: - assert isinstance(route, web.RouteDef) - api_routes.route(route.method, "/api" + route.path)(route.handler, **route.kwargs) + # Custom nodes might add extra static routes. Only process non-static + # routes to add /api prefix. + if isinstance(route, web.RouteDef): + api_routes.route(route.method, "/api" + route.path)(route.handler, **route.kwargs) self.app.add_routes(api_routes) self.app.add_routes(self.routes)