Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sapvs/usho
URL Shortener spring boot application
https://github.com/sapvs/usho
cache docker-compose galera java mysql redis-cache spring-boot url-shortener-microservice
Last synced: 3 days ago
JSON representation
URL Shortener spring boot application
- Host: GitHub
- URL: https://github.com/sapvs/usho
- Owner: sapvs
- License: mit
- Created: 2022-08-21T07:34:10.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-07T10:32:59.000Z (about 1 year ago)
- Last Synced: 2023-11-07T11:32:25.435Z (about 1 year ago)
- Topics: cache, docker-compose, galera, java, mysql, redis-cache, spring-boot, url-shortener-microservice
- Language: Java
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# usho
URL Shortner java spring application.
## Architecture
1. nginx frontend
1. Spring Boot Backend
1. Spring Web
1. Spring Redis
1. Spring Data MySQL
1. Redis Cache
1. 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.