Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routers #83

Open
ZeroIntensity opened this issue Nov 13, 2023 · 0 comments
Open

Routers #83

ZeroIntensity opened this issue Nov 13, 2023 · 0 comments
Labels
api This has to do with the Python API (view) feature New feature good first issue An issue that isn't necessarily easy to implement, but not required to be an expert in view.py
Milestone

Comments

@ZeroIntensity
Copy link
Owner

Feature description

To support or help people migrate from other libraries, view.py should introduce routers. These should be quite easy to implement, and the loader should take care of most of it.

Feature example API

A very basic implementation would be:

from view import new_app, Router

app = new_app()
router = Router()

@router.get("/")
async def index():
    return "hello, view.py"


app.load([router])
app.run()

I think we could go further though, and have some magic involved:

from view import new_app, new_router

app = new_app()
router = new_router(prefix="/hello")  # call get_app() internally and assign a router to the app instance

@router.get("/")
async def index():
    return "hello, view.py"

# automatically assign routes to app
app.run()

Anything else?

No response

@ZeroIntensity ZeroIntensity added good first issue An issue that isn't necessarily easy to implement, but not required to be an expert in view.py feature New feature api This has to do with the Python API (view) labels Nov 13, 2023
@ZeroIntensity ZeroIntensity added this to the Beta milestone May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api This has to do with the Python API (view) feature New feature good first issue An issue that isn't necessarily easy to implement, but not required to be an expert in view.py
Projects
None yet
Development

No branches or pull requests

1 participant