Simple rest api which shorten the url and keep in a redis database.
curl -X POST -d '{"url":"https://www.google.com"}' -H "Content-Type: application/json" http://localhost:8080/api/urls
curl http://localhost:8080/api/urls/{hash}
NodeJS is serving the react application which is calling the api to generate the hash given a url, and also handling the routes.
- http://localhost:3000 - render react application
- http://localhost:3000/{hash} - fetch from api and redirect to target url
- http://localhost:3000/404.html
To run locally docker and jdk8 are required.
$ ./url-shortener-api/gradlew build -p url-shortener-api
$ docker-compose build
$ docker-compose up