[BUG] The router is unable to add Starlette's HTTPEndpoint
See original GitHub issueDescribe the bug I cannot find a way to add Starlette’s HTTPEndpoint onto app.router.
To Reproduce Steps to reproduce the behavior:
-
Create app:
app = fastapi.FastAPI()
-
Create an endpoint:
class HealthHandler(starlette.endpoints.HTTPEndpoint):
async def get(self, request):
return starlette.responses.JSONResponse({'status': 'OK'})
- I am stuck now, I cannot see a way to add HTTPEndpoint into
app.router
.
Expected behavior Able to add HTTPEndpoint class.
Environment:
-
OS: macOS
-
FastAPI Version:
fastapi==0.29.1
-
Python version: 3.7.3
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Routing - Starlette
A class that implements the ASGI interface, such as Starlette's HTTPEndpoint. Path Parameters. Paths can use URI templating style to capture path components....
Read more >Resolving common Linksys cloud account error messages
On the Linksys Smart Wi-Fi Sign In page, you may see an error message that says Internet connection is down. This happens when...
Read more >I'm getting a Router Not Found error when I try to install my ...
If you use the NETGEAR Nighthawk or Orbi app to install your router or mesh system, and the app can't detect your NETGEAR...
Read more >[Troubleshooting] Failed Internet access through router - ASUS
When you found out your devices like computers, phones which couldn't get internet access after connecting to the router, could try ...
Read more >Use routers secured with HomeKit - Apple Support
Add more protection to your HomeKit accessories by controlling which services and devices they communicate with on your home Wi-Fi network ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s not really how FastAPI’s meant to look like. However, if you wanted to define an endpoint that way, remember you are in a Starlette environment:
Therefore, what you could do is:
@stefanondisponibile @didip
Starlette
(andFastAPI
as subclass) hasadd_route
method so there is no need to create cyclical dependencies: