platformplatform / PlatformPlatform

🚀 Pre-alpha state. A platform designed for building enterprise-grade, multi-tenant products using Azure, .NET, React, TypeScript, Infrastructure as Code, etc.
https://platformplatform.github.io
MIT License
245 stars 26 forks source link

Simplify SinglePageApp and static file serving with .NET Minimal API MapFallback #488

Closed tjementum closed 3 months ago

tjementum commented 3 months ago

Summary & Motivation

Move logic for serving the SinglePageApp and static files to a .NET Minimal API MapFallback(), simplifying the setup. The index.html is not read until the first request. However, there is still a small chance that the SinglePageApp may not be fully generated when accessing the WebApp, so additional measures have been taken to enhance stability.

Previously, a WebAppMiddleware was used to serve the SinglePageApp and static files, leading to several challenges. For instance, generating the Open API contract with NSwag as part of the normal API build was problematic since the static index.html was not yet generated. To work around this, a "dummy" index.html was checked into source control, and timers were implemented to detect file creation.

Checklist

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
51.4% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud