POST to localhost

Hi,
May I ask that, if I am trying to do a POST do a random port e.g. https://localhost:5001/api/TodoItems/1. and In “Body” is just a simple, raw, JSon, then;
{

“name”:“walk dog”,

“isComplete”:true

}
However, no matter what port I am choosing, I always get “Error: connect ECONNREFUSED”
I already disabled SSL certificate verification and unticked using system proxy. Is there a way for me to just POST to my localhost

Do you have a webserver configured locally, and listening at that port? Is there a reason you are using 5001 over just 80 or 443? Otherwise I recommend staying in common port territory.

Thank you for replying.
no, I have not made any webserver configuration locally. May I know what is the range of the common port territory too?
So basically I have to do a local webserver configuration and uses common port?

Hey @zhangmingcheng28 Yes! You need to have a webserver that is listening on localhost over the port number you are trying to access.

Once you send the request via Postman to that server, it will (or should) process your request and then return a response.

Here is a tutorial using NodeJS to create a simple web-server running locally: https://nodejs.org/en/knowledge/HTTP/servers/how-to-create-a-HTTP-server/

If you prefer any other language, search online to find out how to create a web-server using that programming language.

Hi, I am having difficulties while connecting to localhost. On sending a POST request, I am having Could not send request in Postman response.