Giter VIP home page Giter VIP logo

holiday-extras-test's Introduction

RESTful

The RESTful API is live and can be used as follows:

Get all users
GET https://7l1yntxte9.execute-api.eu-west-1.amazonaws.com/dev/users

Get user by id
GET https://7l1yntxte9.execute-api.eu-west-1.amazonaws.com/dev/users/{id}

Update user by id
PUT https://7l1yntxte9.execute-api.eu-west-1.amazonaws.com/dev/users/{id}

Create user
POST https://7l1yntxte9.execute-api.eu-west-1.amazonaws.com/dev/users

Delete user by id
DELETE https://7l1yntxte9.execute-api.eu-west-1.amazonaws.com/dev/users/{id}

The request Header should include:

Content-Type:application/json

N.B. the response HTTP will always be 200. For failed requests look for errors property in the returned JSON object

PostMan collection with all RESTful calls can be imported from the postman_collection file in the root of the project

Technology stack

The API was build using the serverless.js plugin, which is used here to manage and deploy AWS Lambdas and related resources

Data is stored in DynamoDB

Unit tests can be run using Mocha.js

Install serverless.js

The framework used is serverless - excellent documentation can be found here: http://docs.serverless.com/. Basic commands are:

Initialize project

sls project init

Install node.js dependencies

npm install

Add the following to the s-variables-common.json (you will need to create a DynamoDB table with id primary key)

"dynamoDbTable": "holiday-extras-users"

Run Lambda function locally (will pass event.json as event)

sls function run [functionName]

Deploy Lambda function to AWS

sls function deploy [functionName]

Deploy endpoint (AWS API Gateway) to AWS

sls endpoint deploy [endpointName[

Run Mocha unit tests

npm test

N.B. the command is defined in package.json inside scripts:{}

holiday-extras-test's People

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.