ZeroIntensity / view.py

The Batteries-Detachable Web Framework
https://view.zintensity.dev
MIT License
206 stars 15 forks source link

URL Pattern Loader #84

Closed ZeroIntensity closed 8 months ago

ZeroIntensity commented 8 months ago

Feature description

Something like Django's urls.py could be integrated into view. The path to the file could be set as the loader_path in the config.

Feature example API

# paths.py
from view import patterns, path
from something import my_route

patterns(
    path("/hello/world", "/path/to/file.py"),
    path("/", my_route)
)

I think a patterns function could be more "pythonic", but a URL patterns variable could be allowed too:

# paths.py
from view import path
from something import my_route

patterns = (
    path("/hello/world", "/path/to/file.py"),
    path("/", my_route)
)

Anything else?

No response