Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 1.6 KB

README.md

File metadata and controls

60 lines (44 loc) · 1.6 KB

Serverless Shrink

URL shortener API built with the Serverless framework.

Usage

Request

curl --location --request POST 'https://go.vann.io' \
--header 'Content-Type: application/json' \
--data-raw '{"url": "http://www.superlongridiculousurl.com"}'

Response

{
  "data": {
    "url": "http://www.superlongridiculousurl.com",
    "shrink": "go.vann.io/a43f3e1ce0"
  }
}

Development

Prerequisites

Initialise

  1. Generate user access and secret keys from IAM
  2. Run aws configure to set up AWS caller identity
  3. Check config by running aws sts get-caller-identity

Deployment

  1. Ensure stage config is set correctly in the vars directory*
  2. Comment out the CustomDomainMap block in serverless.yml*
  3. Run serverless deploy --stage <stage> where stage is dev or prod, eg. --stage dev
  4. Set up your custom domain name mapping in API Gateway
  5. Create and verify the accompanying SSL cert in the AWS Certificate Manager*
  6. Restore (uncomment) the CustomDomainMap block in serverless.yml*
  7. Re-run serverless deploy --stage <stage>*

*on initial deploy

Debugging

  • Logs can be found in CloudWatch
  • If things are unsalvageable, you can delete everything to start from scratch:
    1. Remove custom domain name mapping from API Gateway manually
    2. Run serverless remove --stage <stage>