Skip to content

sapvs/usho

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

usho

URL Shortner java spring application.

Architecture

  1. nginx frontend
  2. Spring Boot Backend
    1. Spring Web
    2. Spring Redis
    3. Spring Data MySQL
  3. Redis Cache
  4. MySQL Galera Database

Build

mvn clean package

Run

Makefile

make up

Docker Compose

docker-compose up -f docker/docker-compose.yml
docker-compose -f docker/docker-compose.yml up --scale usho=2

Stop

Makefile

make down

Docker Compose

docker-compose down -f docker/docker-compose.yml

Using Makefile

Start

make up

Stop

make down

Testing

Service runs behind nginx proxying to spring boot container usho

Swagger Not Available

Access http://localhost:4000/swagger-ui.html

Create short URL for long URL

Make

make usho

Curl

curl -X POST "http://localhost:4000/usho" \
-H  "accept: application/json" \
-H  "Content-Type: application/json" \
-d "http://www.google.com"

Response

{"id":"ailjoN","longURL":"http://www.google.com"}

Access short URL to confirm redirect in browser

http://localhost:4000/usho/ailjoN

Delete mapping

curl -X DELETE http://localhost:4000/usho/ailjoN

Confirm again on the browser, accessing URL should return 404.