A job interview task
Create a small web service exposing URL shortening functions. One should be able to create, read, and delete shortened URLs. The API functions will be exposed under the '/api' path while accessing a shortened URL at the root level will cause redirection to the shortened URL.
The project is realised with symfony 5.2, php 8.0, postgres, api-platform and docker
- Clone the project from the repo
git clone git@github.com:fantomas/tiny-url-api.git
- enter the project
cd tiny-url-api
- run docker containers
docker-compose up -d
- You can go to https://localhost/api (should accept initially the SSL certificate)
- Some urls are preloaded with fixtures, and you can see them by calling GET
api/urls
- You can try https://localhost/todor or https://localhost/test for redirections
- You can get inside the php container with
docker exec -it tiny-url-api_php_1 sh
- counter for url visits is implemented. I also have implemented database optimistic lock. Otherwise, in case of heavy traffic we may miss some url hits.
- added API endpoint to read shortened URL redirections count GET
/api/urls/{id}/visits
- added API endpoint to edit shortened URL PUT
/api/urls/{id}
- added some validations for the user data
These are only for demo purposes
- A DB reset and apply of fixtures will happen every time the container is up
- phpunit tests are using the same DB