URL routing processed all on one page, or in sub-modules?

Let’s use the Dash example and say we have an app that routes like so:

@app.callback(Output('page-content', 'children'),
              [Input('url', 'pathname')])
def display_page(pathname):
    if pathname == '/apps/app1':
        return app1.layout
    elif pathname == '/apps/app2':
        return app2.layout
        return '404'

If app1 needs to do additional parsing, for example, say the pathname was /apps/app1/edit, is it better to detect the first part of the pathname in the string (“app1”), then pass it along to a router in app1, which would extract the ‘edit’ parameter from the pathname and do whatever it needs to do?

The other way to do it would be to have an entry for all the possibilities on the routing page:

I’m guessing the former method is the better way to go because then the router doesn’t need to know the details of app1, but I wanted to ask if there was any reason I should keep all the routing on one page since I’m fairly new to development in flask/dash.