'Angular-router not works at vercel

I'm working on the serverless web MEAN and I'm trying to publish on vercel. When I'm trying to access some route through the navigation menu, the router is working fine, but when I try to access that route only http://vercel-dev/some-route they show me error 404.

Here's my vercel configuration:

{
    "version": 2,
    "builds":
    [
        {
            "src": "backend/build/index.js",
            "use": "@vercel/node",
            "config":
            {
                "includeFiles":
                [
                    "backend/build/src/**"
                ]
            }
        },
        {
            "src": "frontend/dist/frontend/**",
            "use": "@vercel/static"
        }
    ],
    "routes":
    [
        {
            "src": "/api/(.*)",
            "dest": "backend/build/index.js"
        },
        {
            "src": "/",
            "dest": "frontend/dist/frontend/$1"
        },
        {
            "src": "/(.+)",
            "dest": "frontend/dist/frontend/$1"
        }
    ]
}


Solution 1:[1]

For work with routes in your SPA, in the root of your repository create a vercel.json with the following

vercel.json
{
  "version": 2,
  "routes": [
    { "handle": "filesystem" },
    { "src": "/.*", "dest": "/index.html" }
  ]
}

Read more examples: https://dev.to/alexmercedcoder/deploying-react-angular-svelte-and-vue-to-netlify-vercel-496j

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 danywalls