Skip to content

feat(app): allow setting static directory at runtime (#414) - #1222

Open
soniafergusonship wants to merge 2 commits into
CrowCpp:masterfrom
soniafergusonship:feat/runtime-static-directory-414
Open

feat(app): allow setting static directory at runtime (#414)#1222
soniafergusonship wants to merge 2 commits into
CrowCpp:masterfrom
soniafergusonship:feat/runtime-static-directory-414

Conversation

@soniafergusonship

Copy link
Copy Markdown

Summary

Adds a runtime Crow::static_directory() setter/getter so the implicit static file root can be chosen without a compile-time CROW_STATIC_DIRECTORY macro (#414).

  • Default remains CROW_STATIC_DIRECTORY ("static/")
  • Must be set before run() / run_async() (path is captured when static routes are registered)
  • CROW_STATIC_ENDPOINT is unchanged
  • Docs updated in docs/guides/static.md

Test plan

  • app.static_directory("alt/") serves files from alt/ at the default static endpoint
  • Omitting the setter still uses CROW_STATIC_DIRECTORY
  • Defining CROW_STATIC_DIRECTORY still sets the default when no runtime call is made

Closes #414

Signed-off-by: soniafergusonship <soniafergusonship@users.noreply.github.com>
Signed-off-by: soniafergusonship <soniafergusonship@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A method to set a new CROW_STATIC_DIRECTORY at runtime

1 participant