Giter Site home page Giter Site logo

bike-share-api's Introduction

bike-share-api

Build Status Coverage Status

How to start development (for Mac)

Install node.js

  • Install nodebrew for controll node.js version reference
  • Use v6.10.3 that AWS Lambda supports
$ nodebrew install-binary v6.10.3
$ nodebrew use v6.10.3
$ node -v
v6.10.3

Execute npm install

$ cd bike-share-api
$ npm install

How to run unit test

We chose AVA as test framework.

$ npm test
# > ava --verbose
#
#
#  ✔ Test example
#
#  1 test passed

Try call api on your local

$ node execute-local.js ports your_bike_share_member_id your_bike_share_password 1
# => [ { ParkingEntID: 'TYO',
#        ParkingID: '10092',
#        ParkingLat: '35.658911',
#        ParkingLon: '139.792531',
#        portNameJa: 'H1-01.豊洲IHIビル前(晴海通り)',
#        portNameEn: 'H1-01.Toyosu IHI biru Mae',
#        availableCount: 3 },

Set up awscli

Install python3

See here

$ brew install python3

Download access key from IAM console for your AWS account

accessKey.csv will be downloaded

See AWS document for details.

Install awscli

$ pip install awscli
$ aws configure
# AWS Access Key ID [None]:your_access_key_id
# AWS Secret Access Key [None]:your_secret_access_key
# Default region name [None]: ap-northeast-1
# Default output format [None]:json

Install serverless framework

$ npm install -g serverless
$ sls -v
1.27.2

Init serverless project (You don't have to do this)

$ sls create --template aws-nodejs

Deploy to aws

$ sls deploy -v
# You can see endpoint URL in log

Call deployed API

$ curl -s -d '{"MemberID":"your_bike_share_member_id","Password":"your_bike_share_member_id"}' \
  https://your_endpoint.execute-api.ap-northeast-1.amazonaws.com/dev/areas/3/ports

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.