https://github.com/alifruliarso/griddb-url-shortener
A simple URL Shortener API using Java Spring-Boot & GridDB
https://github.com/alifruliarso/griddb-url-shortener
devtools docker-compose griddb inotifywait livereload spring-boot url-shortener
Last synced: 4 months ago
JSON representation
A simple URL Shortener API using Java Spring-Boot & GridDB
- Host: GitHub
- URL: https://github.com/alifruliarso/griddb-url-shortener
- Owner: alifruliarso
- Created: 2023-05-22T16:31:29.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-15T17:21:36.000Z (almost 2 years ago)
- Last Synced: 2025-01-10T12:17:40.420Z (5 months ago)
- Topics: devtools, docker-compose, griddb, inotifywait, livereload, spring-boot, url-shortener
- Language: Java
- Homepage:
- Size: 229 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Building URL Shortener API using Java Spring-Boot & GridDB
**Prerequisites**:
- [Java OpenJDK 17](https://bit.ly/openjdk1706)
- [Docker 23.0.1](https://docs.docker.com/engine/install/)## Technology Stack
Back-end: Spring Boot, Maven\
Database: GridDB 5.1.0## Run Application
Build the docker image:
```shell
docker compose build
```Run the app with Docker Compose:
```shell
docker compose up
```#### The following ports are exposed:
* The application runs on port 8080.
* Port 35729 allows the livereload plugin to listen to changes
* Port 5005 makes the debugger available to the IDE## API Documentation
Swagger-UI available at http://localhost:8080/swagger-ui/index.html### Create a short URL
`POST http://localhost:8080/api/urls`#### Postman
![]()
#### cURL
curl --request POST --url http://localhost:8080/api/urls --header 'content-type: application/json' \
--data '{"url": "https://www.javacodegeeks.com/2023/05/what-are-events-relation-to-api-calls.html"}'#### Response
{
"url": "https://www.javacodegeeks.com/2023/05/what-are-events-relation-to-api-calls.html",
"shortUrl": "HjlQjET"
}### Get original URL
`GET http://localhost:8080/api/urls/{SHORT_URL}`#### Postman
![]()
#### cURL
curl --request GET --url http://localhost:8080/api/urls/HjlQjET#### Response
{
"url": "https://www.javacodegeeks.com/2023/05/what-are-events-relation-to-api-calls.html",
"shortUrl": "HjlQjET"
}## Reference Documentation
* [Being able to automatically build and deploy changes to without having to manually build or restart the application](https://medium.com/trantor-inc/developing-spring-boot-applications-in-docker-locally-4ec922f4cb45)
* [livereload using spring-boot-devtools](https://docs.spring.io/spring-boot/docs/current/reference/html/using.html#using.devtools)tags: `url-shortener` `shortener` `griddb` `spring-boot` `json-api` `docker` `live-reload` `inotify-tools`