0

In postman web version When I send a request using get localhost:8080 it's just giving an arror. Cloud Agent Error: Can not send requests to localhost. Select a different agent. Please help me about the situation. Is there any problem with my Vs codes ?

const express = require("express");
const app = express();

/* app.use((req, res)=> {
}); */

app.get("/", (req, res) => {
  res.send("This is the home page");
});

app.get("/cats", (req, res) => {
  res.send("MEOW");
});

app.get("/dogs", (req, res) => {
  res.send("woof");
});

app.post("dogs", (req, res) => {
  res.send("Post request to /cats. This is diffrent than get");
});

app.get("*", (req, res) => {
  res.send("I don't know what that path");
});

app.listen(8080, () => {
  console.log("Listening on port 8080");
});
Ömer Koçar
  • 13
  • 1
  • 4

2 Answers2

1

The Cloud Agent runs in the Cloud.

"Cloud" is a buzzword loosely meaning someone else's computer.

Their computer cannot access services running on your private loopback network interface (i.e. localhost).

If you want the Cloud Agent to access your service then you need to host it on the public Internet.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
0

I encountered a similar error, I had to download and install postman on my local machine instead of using Postman web and it worked fine.