Skip to content

Latest version of Portfolio API code. Using Serverless Framework and Express. Exposes data in AWS DynamoDB table. Deployed to AWS.

Notifications You must be signed in to change notification settings

bloo0178/portfolio-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Portfolio Projects API (May 2019)

This replaces the existing project "portfolio-site-api."

Description

This is the code for the API that is used to provide my portfolio site with project data that is ultimately populated into project cards. This creates a Lambda function that connects to an existing DynamoDB table and then exposes its data through an AWS API Gateway. Commented out code in the .yml could also be uncommented and included to create a new DynamoDB table upon deployment.

Deploy

Run the following command:

  • serverless deploy --stage prod

Teardown

Run the following command:

  • serverless remove --stage prod

Testing

There are multiple ways to test this app.

DEV - The first involves using the Serverless-Offline plugin along with a live dynamoDB (can be dev or prod; not currently doing writes).

  • npm install
  • serverless offline start --stage dev (or "npm run start-dev)
  • test the endpoints using "npm run test"

PROD - After deploying, run the following from AWS CLI to verify the service is up and running (in addition to the Jest unit/ integration tests):

  • aws apigateway test-invoke-method --rest-api-id (api id here) --resource-id (resource id here) --http-method (method here - 'GET', 'POST', etc.)

You can use the following to obtain info on your service:

  • serverless info
  • aws apigateway get-resources --rest-api-id (api ID here)

The API ID can be obtained using serverless info above. It will provide you with your AWS endpoints. In the URL, the text after https:// is your API ID. (i.e. https://caufjc1cde.execute-api.us-east-1.amazonaws.com/dev/projects --> caufjc1cde is the API ID). Then use the get-resources AWS command to obtain your resource-id

Useful links

About

Latest version of Portfolio API code. Using Serverless Framework and Express. Exposes data in AWS DynamoDB table. Deployed to AWS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published