I have a up and running nodejs server (with one API) on my local machine .
I have created the new docker container for krakend using
docker run -p 8080:8080 -v $PWD:/etc/krakend/ devopsfaith/krakend run --config /etc/krakend/krakend.json
Although, I have to make some changes in above command because I am working on windows.
I have created a krakend.json file and it's content are
{
"version": 3,
"timeout": "3s",
"cache_ttl": "300s",
"port": 8080,
"default_hosts": ["http://localhost:3001"],
"endpoints": [
{
"endpoint": "/contacts",
"output_encoding": "json",
"extra_config": {
"qos/ratelimit/router": {
"max_rate": 5000
}
},
"backend": [
{
"host": [
"http://localhost:3001",
"http://cotacts:3001"
],
"url_pattern": "/contacts",
"is_collection": "true",
"encoding": "json",
"extra_config": {
"backend/http": {
"return_error_details": "backend_alias"
}
}
}
]
}
]
}
But when I am hitting the url http://localhost:8080/contacts
using postman I am getting
[KRAKEND] 2022/03/14 - 07:26:30.305 ▶ ERROR [ENDPOINT: /contacts] Get "http://localhost:3001/contacts": dial tcp 127.0.0.1:3001: connect: connection refused
I found a relevant one over here connection refused error with Krakend api-gateway?
but, I am not getting what to change in my case