SPA and Router - serving spa assets on any spa route

System Information
  • Strapi Version: 3.6.8
  • Operating System: ubuntu
  • Database: mysql
  • Node Version: 14

Hi, a question about Router and SPA
Im trying to serve the react app files on any route that does not exist, I found this code snippet:

but this breaks the documentation plugin routes, and I dont know what other routes as well.
How to correctly serve the SPA app assets?
How to correctly configure the Router so that it wont break other routes?
How to configure the router to only work with the first matched Route?