# Can't get response from local rest api server

**URL:** <https://discuss.konghq.com/t/cant-get-response-from-local-rest-api-server/5708>\
**Category:** Questions\
**Created:** [March 4, 2020, 8:06am UTC](https://discuss.konghq.com/t/cant-get-response-from-local-rest-api-server/5708 "2020-03-04T08:06:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bloo-kim](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@bloo-kim](https://discuss.konghq.com/u/bloo-kim)\
**Post date:** [March 4, 2020, 8:06am UTC](https://discuss.konghq.com/t/cant-get-response-from-local-rest-api-server/5708/1 "2020-03-04T08:06:40Z")

</div>

Hello, I’m noob in kong.

I have some question for Kong Service.

I’ve installed kong in docker and add two api Services,Routes

1. host url : [https://jsonplaceholder.typicode.com/](https://jsonplaceholder.typicode.com/) , kong service path : /fakejson  
route method : get

as you know, ‘[jsonplaceholder.typicode.com/](http://jsonplaceholder.typicode.com/)’ serve fake json data.  
when I call localhost:8000/fakejson/users, it works.

1. host url : ( host.docker.internal or docker.for.mac.host.internal or my global IP / I’ve tried all)  
. kong service path : /local  
route method : get

I’ve run the rest api server(node.js) in local env and I can get right response by direct call  
when I use Kong api call, It doesn’t work.

I attached the node server code.  
////////////////////////////////////////////////////  
var express = require(‘express’);  
var app = express();

app.get(’/test1’, function (req, res) {  
var samplejson = [{‘hello’ : ‘world’}];  
res.send(samplejson);  
});

app.get(’/test1/1’, function (req, res) {  
var samplejson = {‘hello1’ : ‘world1’};  
res.send(samplejson);  
});

// Port setting  
var port = 34421;  
app.listen(port, function(){  
console.log(‘server on! [http://localhost](http://localhost):’+port);  
});  
/////////////////////////////////////////////////////////////

Could someone answer me??

---

<div class="post-metadata">

**Author:** ![narate](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/narate/32/1778_2.png) [@narate](https://discuss.konghq.com/u/narate)\
**Post date:** [March 4, 2020, 9:23am UTC](https://discuss.konghq.com/t/cant-get-response-from-local-rest-api-server/5708/2 "2020-03-04T09:23:11Z")

</div>

I think the problem is about the Docker network.  
Kong in docker doesn’t know your NodeJS Express app.  
Uses kong in docker with a host network.

The host network work with linux host for service url with loopback.

- docker-compose  
`network_mode: host`

- docker cli  
`--net=host`

Then you can config kong service with `url=http://127.0.0.1:34421`

If you use macOS with local NodeJS App dev checking port binding is port binding with `0.0.0.0` for all incoming request.

---

<div class="post-metadata">

**Author:** ![bloo-kim](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@bloo-kim](https://discuss.konghq.com/u/bloo-kim)\
**Post date:** [March 5, 2020, 12:27am UTC](https://discuss.konghq.com/t/cant-get-response-from-local-rest-api-server/5708/3 "2020-03-05T00:27:07Z")

</div>

Hello nanate!

First of all, thank you for answering me,

but I’ve tried ‘curl’ from docker container(KONG) to my local Node Server \<- It works

So I guess It is not a problem with container network or port. T\_T
