https://github.com/tsamaya/aws-lambda-whereis
https://github.com/tsamaya/aws-lambda-whereis
aws-lambda geocoder google nodejs
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tsamaya/aws-lambda-whereis
- Owner: tsamaya
- License: mit
- Created: 2017-11-29T04:57:04.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-10T19:17:15.000Z (about 3 years ago)
- Last Synced: 2025-02-26T12:17:27.067Z (over 1 year ago)
- Topics: aws-lambda, geocoder, google, nodejs
- Language: JavaScript
- Size: 1.09 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# aws-lamba-whereis
[](https://travis-ci.org/tsamaya/aws-lambda-whereis) [](https://codecov.io/gh/tsamaya/aws-lambda-whereis)
:warning: work in progress with webpack / es6
## Quick start
### Prerequisites
- node, npm or yarn
- serverless : `$ npm install -g serverless`
- what3words API key : [register](https://accounts.what3words.com/)
- opencagedata API key : [register](https://geocoder.opencagedata.com/users/sign_up)
- google API key : [register](https://developers.google.com/)
### AWS - Credentials
To deploy; an AWS account is needed, AWS lambda is available with the free tier account for 12 months : https://aws.amazon.com/lambda/pricing/
[Watch the video on setting up credentials](https://www.youtube.com/watch?v=KngM5bfpttA)
or look at serverless documentation about [credentials](https://serverless.com/framework/docs/providers/aws/guide/credentials/)
Adding a profile on the AWS config
$ serverless config credentials --provider aws --key --secret --profile
### Clone the repo
$ git clone https://github.com/tsamaya/aws-lambda-whereis.git
$ cd aws-lambda-whereis
### Setup
$ npm i
create `environment.yml` file
$ serverless env --attribute GOOGLE_API_KEY --value --stage dev
$ serverless env --attribute W3W_API_KEY --value --stage dev
$ serverless env --attribute OPCD_API_KEY --value --stage dev
create `.env` file
$ serverless env generate
### Running locally
$ sls offline start
or
$ npm start
#### sunny tests
$ curl "http://localhost:3000/whereis?lat=40.714224&lng=-73.961452"
$ curl "http://localhost:3000/whereis?addr=index.home.raft"
#### rainy tests
$ curl "http://localhost:3000/whereis"
$ curl "http://localhost:3000/whereis?lat=40.714224"
$ curl "http://localhost:3000/whereis?lat=aa&lng=bb"
$ curl "http://localhost:3000/whereis?addr=aa.bb.cc"
### deploy
$ sls --aws-profile --stage deploy
### display logs
$ sls --aws-profile --stage logs -f whereIs -t
### Unit tests and coverage
$ npm test
$ npm run coverage
## Revision history
1.1.0 TBD ES6 and webpack rework, keep one function
1.0.0 06/12/2017 Creation with 2 functions
## Resources
- [serverless](https://serverless.com)
## Licensing
Licensed under the MIT License
A copy of the license is available in the repository's [LICENSE](LICENSE.md) file.