Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Link Shortener application

Synopsis

Provides services to generate short urls and redirection using the generated short urls. Some basic statistics services are also provided. Developed using spring boot / rdbms persistence apache derby db

Local setup

  • clone repo
git clone https://github.com/iantowey/short_links.git
  • build project and docker images
$MVN_HOME/bin/mvn -Dspring.profiles.active=test clean verify install jacoco:report dockerfile:build site
  • start apache derby db
docker run -d -p 1527:1527 --name=docker_apachedb az82/docker-derby
  • start spring boot link shortener application
docker run -d -t --name link_shortener_app --link docker_apachedb:docker_apachedb -p 8080:8080 itowey/link-shortener-app

API endpoints and Sample usage

  • Swagger Documentation
http://localhost:8080/swagger-ui.html 
  • Request some short link generation
for url in "www.bbc.co.uk" "www.google.co.uk" "www.rte.ie" "www.cnn.com" "www.youtube.com" "www.facebook.com" "www.baidu.com" "www.yahoo.com" "www.amazon.com" "www.wikipedia.org" "www.qq.com" "www.twitter.com"
do
echo $url
curl -H "Content-Type: text/html" -d $url -X POST http://localhost:8080/short/link
echo 
done
  • view all processed links
curl -X GET http://localhost:8080/short/links
  • test redirects (link sourced from ehcache), redirect client info persisted to table : short_links.hit_metrics (redirect to youtube)
http://localhost:8080/ly/281dab9e

or

curl -v -X GET http://localhost:8080/ly/281dab9e
  • check hit metrics for link with id
http://localhost:8080/stats/5

Dev notes

Principal Tech stack components

  • Java 8
  • Ehcache
  • Spring
  • Swagger Api Documentation
  • Spring Data JPA
  • Jacoco Code Coverage
  • Findbugs
  • Spring Boot
  • Apache Derby DB
  • Docker

Development Documetation

Unit test, Integration test, code coverage and findbugs report are be viewed in document

target/site/index.html

About

app to generate short urls

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages