It shrinks your link
- TypeScript
- serverless
- serverless-offline
- mongodb-memory-server
- webpack
- mongoose
- eslint
- jest
- prettier
- husky
- Github Actions
- snyk
-
Add a link
POST /hash body { url: "example.com" }
response
{ "hash": "fkwKwr" }
-
Get a link by hash
GET /url?hash=fkwKwr
response
{ "url": "example.com" }
-
Get the statistics for URL
POST /stats/url { url: "example.com"}
response
{ "url": "example.com", "hashes": ["fkwKwr", "gown2s" ....], "ipAddresses": ["1.1.1.1", "8.8.8.8", ....], "requests": 1 // how many times this URL has been fetched, regardless of hash }
-
There's a cronjob which will delete unused links in the past year every day at 12.00am.
- clone it
- run
yarn
- rename
.env.example
to.env
- replace the value of
MONGO_URI
- Make sure you have AWS CLI configured
- Make sure the AWS IAM user you have configured in AWS CLI has permissions for Lambda, IAM, S3, CloudWatch, API Gateway and CloudFormation
- Make sure you replaced
MONGO_URI
with a correct one - run
sls deploy
. Or change thedeploy-sls
script and run that