fix: start server when rest_api is enabled and gate static file servi…#801
Open
CollegeRideOut wants to merge 1 commit intoEpicGamesExt:masterfrom
Open
fix: start server when rest_api is enabled and gate static file servi…#801CollegeRideOut wants to merge 1 commit intoEpicGamesExt:masterfrom
CollegeRideOut wants to merge 1 commit intoEpicGamesExt:masterfrom
Conversation
…ng behind serve flag
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #767
Relevant components:
Problem statement:
When
serve=falseandrest_api=true, the REST API is not accessible.Although the REST API routes and middleware are registered on the Express app via the OpenAPI initialize(...) call, the HTTP/HTTPS server is only started when serve=true through the WebServer. As a result, no server is listening to handle incoming API requests, which can lead to unexpected responses (e.g. 426 Upgrade Required).
Solution
Start the server when either
serveorrest_apiis enabled.Additionally, static file serving (
express.static) and the/homepage route are now conditionally applied only whenserve=true.This ensures:
rest_api=trueserveNote: This change keeps the existing configuration structure. Fully separating server startup and static file serving would require introducing a dedicated configuration option (e.g.
serve_static), which is outside the scope of this fix.Documentation
No documentation changes required.
Test Plan and Compatibility
Verified that:
serve=falseandrest_api=true→ API is accessibleserve=true→ static files and homepage are served as beforeserve=trueandrest_api=true→ both API and static content work as expectedExisting behavior for static file serving remains unchanged when
serve=trueChanges are limited to:
SignallingWebServer/src/WebServer.tsSignallingWebServer/src/index.tsThis Markdown was written with AI i wrote the code by hand