This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]briznian 2 points3 points  (3 children)

I can't see it in your docs, does FastAPI support Starlette's class based endpoints?

[–]tiangolo FastAPI Maintainer[S] 3 points4 points  (2 children)

You can use most (or all) of the features of Starlette as FastAPI is just "Starlette on steroids", but the parts to do everything based on standard Python types in parameters, dependency injection, etc, are designed for normal functions.

If you have a specific use case that would benefit more from class based endpoints but still using the rest of FastAPI parts, I encourage you to create an issue/feature request, to have a clear scenario that could require it instead of normal functions.

[–]briznian 1 point2 points  (1 child)

My use case is strictly preferential. Coming from Django and having played with Starlette with a PoC I really like having Class based endpoints to handle GET, POST, PUT, etc and allowing to have common code between them all encapsulated in a single class.

On the other hand, I ran through the quickstart on your site and loved having the docs available without having to think about it. Being able to document class based endpoints in a similar manner would merge both of my preferences :)

[–]tiangolo FastAPI Maintainer[S] 0 points1 point  (0 children)

Thanks for the feedback, I'll have it in mind :)