Connection refused when creating a local API server
I'm following Simple API server | Deno Docs:
1. Create
server.ts
:
2. Run deno run -A --unstable server.ts
. The site says "Please provide a slug"
3. Run:
I get this error:
Searching for the error, I think I need to replace localhost
with 127.0.0.1
:
This doesn't help either.
In my understanding, it should return
Do you know what goes wrong?
(Also asked on Stack OVerflow)Simple API server | Deno Docs
Deno is great for creating simple, light-weight API servers. Learn how to create
Stack Overflow
curl (7): Failed to connect to localhost port 8000: Connection refused
Hello I am testing the endpoint and when I run php testing.php I get this error. Any help would be appreciated it.
Fatal error: Uncaught exception 'Guzzle\Http\Exception\CurlException' with
Stack Overflow
Connection refused when creating a local API server
I'm following Simple API server | Deno Docs:
Create server.ts:
const kv = await Deno.openKv();
Deno.serve(async (request: Request) => {
// Create short links
if (request.method == "P...
4 Replies
I'm unable to reproduce that error on my end. I get the expected response
sorry for posting in multiple place
do you know how to debug this?
Others might have more knowledge in this area than me. It sounds like a network configuration issue on the machine you're using.
hmm, I check again, and this seems that I accidentally used an WSL shell, while launched the server on a normal shell
using the normal one returns the data fine