✂️ URL shortener API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
funcs Shorter slug Feb 19, 2018
vars Add custom domain Jul 24, 2017
.gitignore Update readme + refactor (#1) Feb 13, 2018
README.md
serverless.yml Shorter slug Feb 19, 2018

README.md

Serverless Shrink

URL shortener API built with the Serverless framework.

POST a URL to https://go.vann.io:

curl -H "Content-Type: application/json" -X POST -d '{"url": "http://www.superlongridiculousurl.com"}' https://go.vann.io

Example response:

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

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 sls deploy --stage <stage> where stage is dev or prod, eg. --stage dev
  4. Set up API Gateway custom domain name mapping
  5. Add DNS records to point your domain to API Gateway*
  6. Restore the CustomDomainMap block in serverless.yml*
  7. Re-run sls 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 sls remove --stage <stage>