Browse Source

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

Falko Schindler 2 years ago
parent
commit
fce725d4c0
1 changed files with 2 additions and 0 deletions
  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: