R
RunPod3mo ago
Nicholas

Endpoints vs. Docker Images vs. Repos

Hi, I am new to both Docker and RunPod, so my apologies if this question is overly obvious. I am trying to convert a FastAPI app into a RunPod serverless endpoint. My question is, given that my FastAPI app has many endpoints, how can I access all those endpoints from just one RunPod serverless endpoint? Does it make more sense to create a serverless endpoint for every RESTful endpoint in my FastAPI app? Would I then need to create a different docker image for each endpoint? I've spent a good amount of time looking through the docs, and most of the examples seem to use only one endpoint. Any resources you could point me to would be greatly appreciated. Thanks for your help!
4 Replies
nerdylive
nerdylive3mo ago
You can imagine it this way, the runpod endpoints acts as a proxy, then you hit /run on the endpoint specifying which type of "functions/restful endpoint" you want to use in the request body Or you can use pods if that doesn't work In the inputs*
Encyrption
Encyrption3mo ago
If it where me I would remove the FastAPI portion of your code as the RunPod handler will pass your function your posted JSON without having to run a web server at all. You can parse that JSON however you need so you can have as many virtual endpoints as you need. RunPod runs a web server for you. If you don't want to remove your FASTAPI for some reason then you will have to code your handler to proxy connections between that JSON and your FASTAPI (locally, 127.0.0.1). Doing so will significantly slow down your response time.
Nicholas
NicholasOP3mo ago
@nerdylive @Encyrption Oh okay, that makes a lot more sense. Thank you both for pointing me the right direction. I was totally lost before
nerdylive
nerdylive3mo ago
Sure that works too
Want results from more Discord servers?
Add your server