Skip to content

Kotomaro/interactive-voice-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interactive Voice REST API

This serverless application exposes two endpoints to create and update sub-customers in a dynamoDB database, using AWS Lambda and AWS API Gateway.

The endpoints are:

  • /sub-customers (POST): This endpoint uses 3 body parameters, "customerId", "subCustomerId" and "subCustomerName". It inserts a new sub-customer with a composite key formed by "CustomerId" and "subCustomerId" parameters, and the provided "subCustomerName" as an attribute. It will return a 201 on successful insertion, and a 500 error on failure.

  • /sub-customers/:subCustomerId (PUT): This customer uses 2 body parameters, "customerId" and "subCustomerName". It matches the element with the corresponding "customerID" and "subCustomerID" and updates its "subCustomerName" to the provided value. If the element does not exist, it will be created. It will return a 200 on succesful update, and a 500 error on failure.

How to run and deploy

Running in local

To run the provided code, some dependencies are needed.

To run the API locally, open a console on the root directory of the project and run the command serverless offline. This will use the serverless-plugin to deploy an offline version of a dynamoDB database, Lambda and API Gateway, and will launch the application. You'll have to point the dynamoDB endpoint to your local instance of the database.

Deploying to AWS

To deploy the API to Amazon Web Services, run the command serverless deploy. It will package and create the necessary elements in AWS to deploy and run the application. It is important that the AWS user you assigned to the CLI has the necessary permissions to access all the services needed:

  • dynamoDB
  • cloudFormation
  • S3
  • IAM
  • APiGateway
  • Cloudwatch log
  • Lambda

Once the deployment is successful, make note of the URL endpoint displayed on console to access your API.

Testing

The application has Cucumber tests that can be run from a console with the command npm run test-cucumber. This will run the Scenarios defined in subCustomer.feature file, following the step definitions found inside the step_definitions folder, in the subCustomerSteps.js file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published