Skip to content

Latest commit

 

History

History
75 lines (65 loc) · 1.72 KB

README.md

File metadata and controls

75 lines (65 loc) · 1.72 KB

NodeJS Objection Permutations API

REST API for generating JSON object permutations using AWS Lambda

Build Status

Usage

Exposes an API endpoint that accepts JSON objects via POST request. Using Curl:

curl --location --request POST 'https://ld5313ibp5.execute-api.us-east-1.amazonaws.com/dev/permutations' \
--header 'Content-Type: application/json' \
--data-raw '{
    "pilot": ["Han Solo", "Lando Calrissian"],
    "copilot": ["Chewbacca", "Rey"],
    "ship": "Falcon",
    "speed": "1.5c"
}'

Expected response:

[
  {
    "pilot": "Han Solo",
    "copilot": "Chewbacca",
    "ship": "Falcon",
    "speed": "1.5c"
  },
  {
    "pilot": "Han Solo",
    "copilot": "Rey",
    "ship": "Falcon",
    "speed": "1.5c"
  },
  {
    "pilot": "Lando Calrissian",
    "copilot": "Chewbacca",
    "ship": "Falcon",
    "speed": "1.5c"
  },
  {
    "pilot": "Lando Calrissian",
    "copilot": "Rey",
    "ship": "Falcon",
    "speed": "1.5c"
  }
]

Postman

You can test this API using Postman by importing the collection located at ./postman/permutations.postman_collection.json

Development

Install Serverless Framework Globally

npm i -g serverless

Install Dependencies

npm i

The lambda function is located at ./src/permutations.ts.

Validate Types

npm run check

Deployment

Deployment is handled by TravisCI and the Serverless CLI. The serverless stack will be deployed/updated once changes are merged into master. See Serverless config and TravisCI config for configuration.