Home
Softono

Serverless Shrink

Open source TypeScript
18
Stars
2
Forks
0
Issues
0
Watchers
3 years
Last Commit

 About Serverless Shrink

✂️ URL shortener API

Platforms

Web Self-hosted

Languages

TypeScript

Need Help Installing Serverless Shrink?

We provide expert installation service for this software. Our team will install, configure, and secure Serverless Shrink on your server. plans start at just $30.

Serverless Shrink

View on GitHub

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>