'Error - express-http-proxy is giving error when testing routes

I'm building a e-commerce microservices and therefore I'm using "express-http-proxy.

const express = require("express");
const cors = require("cors");
const proxy = require("express-http-proxy");

const app = express();

app.use(cors());
app.use(express.json());

app.use("/customer", proxy("http://localhost:8001"));
app.use("/shopping", proxy("http://localhost:8003"));
app.use("/", proxy("htpp://localhost:8002"));

app.listen(8000, () => console.log("Gateway is listening on port 8000"));

when I test the url "http://localhost:8000/", I receive the following below error code:

Error: getaddrinfo ENOTFOUND htpp
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26)

Searching at this error, I couldn't find anything.

My question is, why am I receiving this error and how to resolve this error?



Solution 1:[1]

If you look at the error, it tells you that it cannot find htpp://.

You probably wanted to use http://, this should fix this error.

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