'Curl localhost connection refused
I am trying to run this command in git bash:
curl http://127.0.0.1:8000/
or
curl localhost:8000/
but I receive this error:
curl: (7) Failed to connect to 127.0.0.1 port 8000 after 2043 ms: Connection refused
tried to npx kill-port 8000 but it didn't solve the issue. when I use the following command, it works without issue on the same port of http://127.0.0.1:8000:
python -m uvicorn main:app
unfortunately, I need to have this with curl command.
Solution 1:[1]
The answer to this question is that I needed to create a server with uvicorn then curl a request. Curl request is just for having a request on an existing server. Uvicorn is the one that creates the server and curl does the requests.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | CFD |
