Azure / Azure/static-web-apps

[Proposal] Option to create a default fallback route for SPA (pre-filled depending of build preset)

Open
#526 2 comments 2 reactions 0 assignees View on GitHub
azure-cli enhancement portal swa-cli
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
When creating and deploying a new app using any modern JS Framework like Angular, Vue, React, etc if you don't create a routing configuration with a fallback route, you're getting a 404 error whenever the browser is refreshed.

Creating this file is not too difficult, but may be prone to errors (see for example https://github.com/Azure/static-web-apps/issues/438), and having a default created for you may help newcomers avoiding issues and streamline the experience.

**Describe the solution you'd like**
Since there's already the possibility to choose build presets for popular frameworks, you may include an option to generate a default config with a fallback route if no config file is detected, or if a config file exists without a fallback route? The fallback path could be overridable like the source code path, api path, etc.

**Describe alternatives you've considered**
Other possible option, but less straightforward / user-friendly:
- Add a SWA CLI command to generate the default config file: `swa init --config`
- The VS Code extension could also generate this file, but it would be better to keep the extension having the same behavior as portal (ie both have this option or none)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.