Dumping vue-router router urls

Hi all !

I made a catchall url in my django urls to let vue-router take over on urls such as /login etc …

re_path('.*', generic.TemplateView.as_view(template_name='index.html')),

BUT that means my server will never return 404 :wink:

Instead, I would like to do:

for url in json.loads(subprocess.check_output('something_that_dumps_routes.js')):
    re_path(url, generic.TemplateView.as_view(template_name='index.html'))

But then, how would you advise to make the script something_that_dumps_routes.js ?

The script should parse the vue-router and output a list of url regexp that should return 404 from my server…

Thanks !

The usual approach is to have a catch-all route in vue-router that displays a 404 on the client-side …

Thanks Linus, do you think it’s not a problem if the server doesn’t reply with 404 on URLs that do not exist ? Is it really complicated to dump the URL router for my backend to pickup ?