tobinbradley/dirt-simple-postgis-http-api

Response Code: 404 - GET http://localhost/list_layers/v1 404 (Not Found)

Closed this issue · 1 comments

Hi - I'm running the API through localhost: 8001. All's well with loading the documentation page. However, no matter which module I run, it returns '404'. Specifically, the url 'http://localhost/list_layers/v1' returns 'as not found on this server'. However, when I past that url into another browser page and add :8001 (http://localhost:8001/list_layers/v1) it returns the expected JSON.

I'm running a local Apache server on MacOS at localhost:80. Is there something I need to tweek in the js to correct this? Do the program's files need to be in some kind of specific folder or location? I've seen hosted apis in other Issues posts but have no idea how to configure this app. Any help would be appreciated. Thanks!

Generally speaking, node apps such as this one are their own server. If you turn off Apache and run the node app on port 80, you'll get the results you're looking for.

If you want to run the app an another port (like 8001), and get to that through something like Apache or nginx, you'll need to create a proxy to it. In Apache you do that with mod_proxy. There are some notes on that in the readme.

You could try adding something like this to the end of your httpd.conf and it should get you headed in the right direction.

ProxyPass "/" "http://localhost:8001"

This tells Apache to pass the document root to your node app and forward the reply to the requester.