In between android work wrote a small service for shortening links.
- Kotlin
- Spring Boot
- Paging
- PostgreSQL
- Swagger
- Gradle
- First, you need to send the original link in the request body to http://localhost:5000/links
{
"original": "https://www.jetbrains.com/ru-ru/opensource/kotlin/"
}
- In response, you will receive a short link:
{
"link": "8cc91d52"
}
- Now, in any browser, insert the required part of the address and the resulting short link into the address bar: http://localhost:5000/links/{linkId}. Congratulations, you have been successfully redirected.
- To get statistics from this short link, make a request: http://localhost:5000/statistics/{linkId}
{
"link": "8cc91d52",
"original": "https://www.jetbrains.com/ru-ru/opensource/kotlin/",
"rank": 1,
"count": 9854
}
- If you want to get statistics on all sites, specify the required page and the number of entries on it (by default, page = 1, count = 10) http://localhost:5000/statistics?count=10&page=1.
- If something goes wrong, you will be notified with an approximate error:
{
"timestamp": "31.12.2021 23:59:59",
"code": 404,
"error": "Not Found",
"message": "Not found original by link = 8cc91d52"
}