An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# aws-lamba-whereis

[![Build Status](https://travis-ci.org/tsamaya/aws-lambda-whereis.svg?branch=master)](https://travis-ci.org/tsamaya/aws-lambda-whereis) [![codecov](https://codecov.io/gh/tsamaya/aws-lambda-whereis/branch/develop/graph/badge.svg)](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.