Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 1.4 KB

README.md

File metadata and controls

54 lines (42 loc) · 1.4 KB

URL Shortener

Simple URL shortener written in Kotlin Spring. Utilizes DynamoDB for storage of the url mappings. Hosted on AWS Elastic Beanstalk (http://myurlshortener-test.eba-esgd5rws.eu-west-1.elasticbeanstalk.com/).

API Reference

To generate a short code for a given url use the following command:

curl --location 'http://myurlshortener-test.eba-esgd5rws.eu-west-1.elasticbeanstalk.com/v1/shortenUrl' \
--header 'Content-Type: application/json' \
--data '{
    "originalUrl": <url/to/shorten>
}'

To access the original url via the short code simply type http://myurlshortener-test.eba-esgd5rws.eu-west-1.elasticbeanstalk.com/v1/<short-code> into your browser.

How to run locally

  1. Add execute permissions to the bash file.
chmod +x ./scripts/create-dynamodb-table.sh
  1. Run docker environment with DynamoDB image.
docker compose -f docker-compose.yml up -d
  1. Create a DynamoDB table.
./scripts/create-dynamodb-table.sh
  1. Run application.
mvn spring-boot:run

How to use locally

To generate a short code for a given url use the following command:

curl --location 'http://localhost:8080/v1/shortenUrl' \
--header 'Content-Type: application/json' \
--data '{
    "originalUrl": <url/to/shorten>
}'

To access the original url via the short code simply type http://localhost:8080/v1/<short-code> into your browser.