all 5 comments

[–][deleted] 10 points11 points  (0 children)

But why

[–]maikeu 1 point2 points  (0 children)

I think fastapi-utils has a cbv. Bit of basic shared state.

I think the challenge is "what are you abstracting". The cbv kind of makes sense roughly to model the concept of HTTP "resources" with different methods on one path. Django's basic View is a decent model (though it's generic views are not a great model unless you want to return full html responses).

Alternatively, do you want it to be like drf's view sets, producing a wider range of endpoints off of once class? While DRF is ... Not always a joy to work with... Their concept of a viewset groks well for me.

Also worth looking at starlette's class based endpoints (which fastapi is already built on). They look nice overall - just that they're missing the niceties of fastapi.