URL shortener API built with the Serverless framework.
curl --location --request POST 'https://go.vann.io' \
--header 'Content-Type: application/json' \
--data-raw '{"url": "http://www.superlongridiculousurl.com"}'
{
"data": {
"url": "http://www.superlongridiculousurl.com",
"shrink": "go.vann.io/a43f3e1ce0"
}
}
- Node 14+
- Serverless framework 3+
- AWS CLI
- Generate user access and secret keys from IAM
- Run
aws configure
to set up AWS caller identity - Check config by running
aws sts get-caller-identity
- Ensure stage config is set correctly in the
vars
directory* - Comment out the
CustomDomainMap
block inserverless.yml
* - Run
serverless deploy --stage <stage>
where stage is dev or prod, eg.--stage dev
- Set up your custom domain name mapping in API Gateway
- Create and verify the accompanying SSL cert in the AWS Certificate Manager*
- Restore (uncomment) the
CustomDomainMap
block inserverless.yml
* - Re-run
serverless deploy --stage <stage>
*
*on initial deploy
- Logs can be found in CloudWatch
- If things are unsalvageable, you can delete everything to start from scratch:
- Remove custom domain name mapping from API Gateway manually
- Run
serverless remove --stage <stage>