Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joeltadeu/shorter-url-service
This repository contains an example of a shorter url service using Java, Spring-boot and Redis as a database.
https://github.com/joeltadeu/shorter-url-service
docker docker-compose grafana java redis spring-boot
Last synced: 3 days ago
JSON representation
This repository contains an example of a shorter url service using Java, Spring-boot and Redis as a database.
- Host: GitHub
- URL: https://github.com/joeltadeu/shorter-url-service
- Owner: joeltadeu
- Created: 2019-09-29T19:13:58.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-06-14T22:46:31.000Z (over 1 year ago)
- Last Synced: 2024-11-10T11:38:41.525Z (2 months ago)
- Topics: docker, docker-compose, grafana, java, redis, spring-boot
- Language: Java
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# shorterurl-service
Most of us are familiar with seeing URLs like bit.ly or t.co on our Twitter or Facebook feeds. These are examples of shortened URLs, which are a short alias or pointer to a longer page link. For example, I can send you the shortened URL **http://bit.ly/SaaYw5** that will forward you to a very long Google URL with search results on how to iron a shirt.# Endpoints
1.**/url**
It will accept the long url as input and convert to a shorter url.
### For example:
POST "https://github.com/joeltadeu/shorterurl/blob/master/src/main/java/com/shorterurl/resource/ShorterUrlResource.java" as raw text to this endpoint.
Endpoint will return:
http://localhost:8080/url/tN72u2j
2.**/url/{key}**
It will extract key from the url and finds the match in redis cache to redirect to long url.
### For example:
GET http://localhost:8080/url/tN72u2j
## Build application```shell
mvn clean package
```## Start infrastructure
Start docker setup with grafana, prometheus, redis and the application.
```shell
docker-compose up
docker-compose down
```## Monitoring
* Prometheus: [http://localhost:9090](http://localhost:9090)
* Grafana: [http://localhost:3000](http://localhost:3000)
* login with admin:admin
* setup "prometheus" data source
* import grafana/grafana-dashboard.json
## Documentation (Swagger)http://localhost:8080/swagger-ui.html