ajnisbet / opentopodata

Open alternative to the Google Elevation API!
https://www.opentopodata.org
MIT License
314 stars 68 forks source link

Healthy endpoint #10

Closed shechter closed 4 years ago

shechter commented 4 years ago

When deploying behind an ELB on AWS, one needs to configure a health check endpoint. / and /v1 return 404 so you must configure a health check URL like localhost:5000/v1/ned10m?locations=38.7181772,-76.5999447 that actually returns data. However this only works once you've configured a dataset.

It could be helpful if you configure an endpoint e.g. /healthy that returns 200 when the server is up.

ajnisbet commented 4 years ago

Thanks for the feature request!

I added /health which returns a 200 code as long as the config can be loaded: https://api.opentopodata.org/health

I tossed up between /health (which isn't versioned) and /api/v1/health (which conflicts with the main endpoint if you have a dataset called health). Neither is ideal but /health is backwards compatible for now. If I ever bump the major version I'll move to /api/v2/health and /api/v2/elevation/<dataset>.