Skip to content

REST API for generating JSON object permutations using AWS Lambda

Notifications You must be signed in to change notification settings

Drew-Kimberly/permutations-api

Repository files navigation

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.

About

REST API for generating JSON object permutations using AWS Lambda

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published