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

Class based views #52

Merged
merged 8 commits into from Aug 30, 2018
Merged

Class based views #52

merged 8 commits into from Aug 30, 2018

Conversation

tomchristie
Copy link
Member

Taken from #35, with a little bit of extra work on top. Huge thanks to @ERM for breaking the back of this one!

Views are now instantiated per-request. Use them either as regular ASGI apps, or route to them with @app.route(...).

We'll also want to add an equivalent for websockets that looks like...

class App(...):
    async def on_connect(self, websocket, **kwargs):
        ...
    async def on_receive(self, websocket, data):
        ...
    async def on_disconnect(self, websocket):
        ...

I'm not totally sure about the naming. We could go for HTTPEndpoint/WebSocketEndpoint instead of "views".

@tomchristie tomchristie merged commit 0693a8f into master Aug 30, 2018
@tomchristie tomchristie deleted the erm-routing-methods branch August 30, 2018 12:53
@tomchristie tomchristie mentioned this pull request Aug 30, 2018
@jeffbuttars
Copy link
Contributor

I like the idea of using '*Endpoint' over 'views'. That's how I talk about API implementations in IRL.

@tomchristie
Copy link
Member Author

@jeffbuttars Indeed. I've included it in the list of potential renames in #51

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.

None yet

2 participants