浏览代码

#742 raise ValueError when hiding the "/_nicegui" route

Falko Schindler 2 年之前
父节点
当前提交
fce725d4c0
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      nicegui/app.py

+ 2 - 0
nicegui/app.py

@@ -71,6 +71,8 @@ class App(FastAPI):
         :param path: string that starts with a slash "/"
         :param directory: folder with static files to serve under the given path
         """
+        if path == '/':
+            raise ValueError('''Path cannot be "/", because it would hide NiceGUI's internal "/_nicegui" route.''')
         globals.app.mount(path, StaticFiles(directory=directory))
 
     def remove_route(self, path: str) -> None: