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.
Description
This PR fixes #1005
Work In Progress
Summary
This PR provides a simple way to add a static directory for the Robyn app and each SubRouter. It calls serve_directory but with fewer arguments and simple defaults. The goal will be to make it a one line addition eg
change from (in the initial example at https://robyn.tech/documentation/example_app/modeling_routes )
to
For the subrouter the same ( https://robyn.tech/documentation/example_app/subrouters_and_views )
'''
frontend = SubRouter(name, prefix="/frontend")
frontend.add_static_files_directory() #using a sane default directory path and "static" as the route both customisable via arguments
@frontend.get("/")
'''
what I want to support are these routes
/static/crimes.css
and '/frontend/static/fronts.css' (where frontend is the object name not the route prefix)Then we can add support to templating allowing us simple access to static files in templates which won't change when the route prefix for frontend changes
PR Checklist
Please ensure that:
Pre-Commit Instructions: