Skip to content
代码片段 群组 项目
未验证 提交 97ae6ef4 编辑于 作者: Chenlei Hu's avatar Chenlei Hu 提交者: GitHub
浏览文件

Add api/ prefix to api endpoints (#3779)

上级 3914d5a2
No related branches found
No related tags found
无相关合并请求
......@@ -527,9 +527,20 @@ class PromptServer():
self.prompt_queue.delete_history_item(id_to_delete)
return web.Response(status=200)
def add_routes(self):
self.user_manager.add_routes(self.routes)
# Prefix every route with /api for easier matching for delegation.
# This is very useful for frontend dev server, which need to forward
# everything except serving of static files.
# Currently both the old endpoints without prefix and new endpoints with
# 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)
self.app.add_routes(api_routes)
self.app.add_routes(self.routes)
for name, dir in nodes.EXTENSION_WEB_DIRS.items():
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册