*Icons made by Freepik from www.flaticon.com*
A serverless link shortener hosted on AWS.
This serverless application is a typical link shortener, but hosted serverlessly.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
What things you need to install this serverless application.
- An AWS account.
- AWS user account with programmatic access.
Install serverless cli globally by
npm install -g serverless
Don't forget to configure your aws as well! You may need to download aws cli here
For more information, please go to the official https://www.serverless.com/framework/docs/getting-started/
There are only 2 endpoints:
GET - https://<your_url>/{name}
:
- A get request with name as the path parameters, example be like:
https://8onb6olqak.execute-api.us-east-1.amazonaws.com/prod/amazon
. It will redirect you to the actual url behind this shorterned link.
POST - https://<your_url>/
:
- A post request with the following field:
name
: The name of the shorterned urlurl
: The actual url that will be redirected to
Example:
$> curl -d '{"name":"<your preferred short name>", "url": "<the actual url>"}' -X POST -H "Content-Type: application/json" <the api gateway url >
It should return your short name in response:
<your preferred short name>
This project had been setup completely with serverless
, to deploy, simply run:
serverless deploy
You should be seeing an API gateway spun up with similar url like https://8onb6olqak.execute-api.us-east-1.amazonaws.com/prod/
- Serverless - Server framework
- AWS DynamoDB - Database
- AWS API Gateway - API gateway for caching etc
- NodeJs - Server Environment
If you have any cool feature in mind, do not hesitate to open up a GitHub issue! I will be very happy to continue with this project.