Written in Node.JS using Serverless architecture for AWS
- API Gateway
- DynamoDB
- Lambda
POST /api/create HTTP/1.1
Host: localhost:3000
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
fullURL=https%3A%2F%2Fwww.thecjgcjg.com
{
"Success": true,
"response": {
"short_url_id": "5ba32d",
"long_url": "https://www.thecjgcjg.com",
"short_url": "https://onyx.sh/5ba32d",
"delete_pass": "3efb3e"
}
}
POST /api/getURLInfo HTTP/1.1
Host: localhost:3000
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
shortURLID=5ba32d
{
"Success": true,
"response": {
"short_url_id": "5ba32d",
"short_url": "https://onyx.sh/5ba32d",
"long_url": "https://www.thecjgcjg.com"
}
}
POST /api/delete HTTP/1.1
Host: localhost:3000
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
shortURLID=5ba32d&deletePass=3efb3e
{
"Success": true,
"response": "Deleted"
}
GET /visit/5ba32d HTTP/1.1
Host: localhost:3000
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
HTTP 301 to Long URL with an empty body.