2525from idom .core .types import RootComponentConstructor
2626
2727from ._asgi import serve_development_asgi
28+ from ._urls import ASSETS_PATH , MODULES_PATH , PATH_PREFIX , STREAM_PATH
2829from .hooks import ConnectionContext
2930from .hooks import use_connection as _use_connection
3031from .utils import (
@@ -44,7 +45,7 @@ def configure(
4445 options = options or Options ()
4546
4647 spa_bp = Blueprint (f"idom_spa_{ id (app )} " , url_prefix = options .url_prefix )
47- api_bp = Blueprint (f"idom_api_{ id (app )} " , url_prefix = "/_idom" )
48+ api_bp = Blueprint (f"idom_api_{ id (app )} " , url_prefix = str ( PATH_PREFIX ) )
4849
4950 _setup_common_routes (api_bp , spa_bp , options )
5051 _setup_single_view_dispatcher_route (api_bp , component , options )
@@ -133,7 +134,7 @@ async def asset_files(
133134 path = urllib_parse .unquote (path )
134135 return await response .file (safe_client_build_dir_path (f"assets/{ path } " ))
135136
136- api_blueprint .add_route (asset_files , "/assets /<path:path>" )
137+ api_blueprint .add_route (asset_files , f"/ { ASSETS_PATH . name } /<path:path>" )
137138
138139 async def web_module_files (
139140 request : request .Request ,
@@ -146,7 +147,7 @@ async def web_module_files(
146147 mime_type = "text/javascript" ,
147148 )
148149
149- api_blueprint .add_route (web_module_files , "/modules /<path:path>" )
150+ api_blueprint .add_route (web_module_files , f"/ { MODULES_PATH . name } /<path:path>" )
150151
151152
152153def _setup_single_view_dispatcher_route (
@@ -189,8 +190,8 @@ async def model_stream(
189190 recv ,
190191 )
191192
192- api_blueprint .add_websocket_route (model_stream , "/stream " )
193- api_blueprint .add_websocket_route (model_stream , "/stream /<path:path>/" )
193+ api_blueprint .add_websocket_route (model_stream , f"/ { STREAM_PATH . name } " )
194+ api_blueprint .add_websocket_route (model_stream , f"/ { STREAM_PATH . name } /<path:path>/" )
194195
195196
196197def _make_send_recv_callbacks (
0 commit comments