Skip to content
This repository has been archived by the owner on Mar 31, 2020. It is now read-only.

Curling results in empty response, server crashes #3

Open
jwflory opened this issue Jan 15, 2018 · 3 comments · Fixed by #12
Open

Curling results in empty response, server crashes #3

jwflory opened this issue Jan 15, 2018 · 3 comments · Fixed by #12

Comments

@jwflory
Copy link
Member

jwflory commented Jan 15, 2018

Summary

curling against localhost results in empty response, server throws ECONNREFUSED and crashes

Analysis

I followed the example in the README to see how the project worked, but I was unable to get the output demonstrated in the README. The server starts up as expected, but when I tried curling, it crashes and I don't receive the payload.

It's unclear to me as to why it's not able to retrieve the data.

Expected results

$ curl http://localhost:8082/api/coordinates/33.385586,66.445313

{
  "iso": "AFG",
  "name_0": "Afghanistan",
  "name_1": "Daykundi",
  "name_2": "Gizab",
  "admin_id": "afg_1_6_53_gadm2-8",
  "lon": 66.445313,
  "lat": 33.385586
}

Actual results

$ curl http://localhost:8082/api/coordinates/33.385586,66.445313
curl: (52) Empty reply from server

---

$ npm run build

> validate_schools@1.0.0 build /home/jflory/git/unicef/coordinates_to_admin_id_server
> babel src -d dist; node dist/server

src/helper.js -> dist/helper.js
src/router.js -> dist/router.js
src/search.js -> dist/search.js
src/server.js -> dist/server.js
Magic happens on port 8082
/home/jflory/git/unicef/coordinates_to_admin_id_server/dist/search.js:30
      if (err) throw err;
               ^

Error: connect ECONNREFUSED 127.0.0.1:5432
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
@mikefab
Copy link
Collaborator

mikefab commented Jan 22, 2018

Did you complete the prerequisites?

  • download_shapefiles_from_gadm
  • import_shapefiles_to_postgres

@jwflory
Copy link
Member Author

jwflory commented Jan 22, 2018

@mikefab Probably not. I was confused by this at first (see #4). I'm going to see if a Docker image could help with this so we don't have to make the user go out and figure out these pre-requisites.

@joyrex2001
Copy link
Contributor

This should be fixed with this pr: #12.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants