Solution to Postmate's geocoding service challenge.
Live version running on AWS Lambda here
- Install python3.
- Clone the repo.
- Copy
secrets.json.example
tosecrets.json
- Set up an account with Here and add your app id and app code to
secrets.json
- Set up an account with Geonames and add your geonames username to
secrets.json
- Done!
Start the server:
=> ./server
Server is running at http://localhost:8000
Make a request:
=> curl http://localhost:8000?address=270%207th%20St,%20San%20Francisco,%20CA%2094103
{"lat": 37.7768998, "lng": -122.4086371}
This project includes an index.py
which deploys to AWS Lambda.
-
Create a bucket in AWS S3 console for the zipped payload.
-
Create a lambda function in the AWS Lambda console.
-
Create an API in the AWS API Gateway console.
-
Create a GET method for your API. Make sure to check "Use Lambda Proxy integration" when creating the method.
-
Use the
deploy-to-lambda
script to zip the project, upload it to S3 and use it in AWS:./deploy-to-lambda LAMBDA_NAME 1.0.0 S3_BUCKET PATH_TO_SECRETS_FILE
-
Test the lambda in the AWS console with data such as:
{ "queryStringParameters": { "address": "Sightglass Coffee" } }
-
Test your API gateway with query string data such as:
address=Sightglass%Coffee
-
Deploy the API Gateway and test against the endpoint!
- Install ruby
- Run
rake test