URL Shortener API – Implementation#5
Open
upendrakumbham wants to merge 5 commits intotpximpact:mainfrom
Open
Conversation
…t in the project (#1)
* Added application entry point class * Added UrlController class * Added serviceImpl class and implemnetents with interface UrlService * Used constructor-based dependency injection in controller to inject UrlService * Integrated Spring Data JPA in DAO layer for database operations and added Lombok to reduce boilerplate code * Added PostgreSQL dependency to enable persistent data storage * Added H2 DB and removed unused dependency * Added Spring boot application yaml file for the dev and required configuration for the url shorten application * Added JPA Entity class to create a table with columns, Request and Response dto classes to carry data * Implemented POST endpoint to create shorten url as per api spec * Added custom exception classes and global exception handlers for the application * Implemented GET endpoint to redirect to full url by alias name * To see hibenate generated queries on the console for the testing * Added helper methods to generate alias and extract bsse url from the full url * Updated service with util * Tweak util class to return proper base url with slash * Implemented GET endpoint to get list of urls * Implemented GET endpoint to return list of urls * Removed unused imports * Removed baseUrl method from the util class. Moved back to static base url to use for the shorten url endpoint as per spec * Changed error message as per spec * Implemented delete endpoint * Removed unused import * A little cleanup * Format code
* Added H2 data files * Added springboot starter test dependency * Added service layer unit tests * Updated H2 Db as part of testing * Upgraded parent starter dependency to 4.0.1 from 3.2.0, 3.0.2 is in the end of life phase(deprecated).Good to upgrade before tests, save tests fixing time. * Upgraded parent starter dependency to 4.0.5 from 4.0.1 to remove vulnerabilities warnings. * Moved back to 3.5.0 to avoid modularised tech saperation package issues * Added web integration(E2E) tests * Added controller unit tests * Added controller integration Mockmvc tests to verify API flow, especially redirection endpoint testing. * Removed unused variable * Rename DB and added more capabilities * We don't need @transactional, data jpa handles that. * Remove unused import * Commit DB data * Added test properties file
* Added connection pool details * Added plugin to run integrations tests through maven and renames classes as per maven * Added jacoco plugin to generate test coverage report and coverage threshold * Dockerized application * Added maven wrapper to run application without maven installation in your local environment * Added DB data file * Added .gitignore * Improved Readability and used var wherever applicable * Added CrossOrigin url to allow frontend origin to contact API * Added latest data * Removed unused DB files * Updated existing README on how to build and run frontend, backend applications * Added DB data file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements a complete URL Shortener REST API using Spring Boot 3.5 and Java 17.
It provides endpoints to create, retrieve, redirect, and delete shortened URLs with proper validation and error handling.
Features Implemented
⚠️ Input validation and error handling
🔗 Shorten long URLs with optional custom alias
🔁 Redirect to original URL using alias
📋 Retrieve all shortened URLs
❌ Delete a shortened URL
🧪 Unit and integration tests
📊 Code coverage using JaCoCo
🐳 Docker support
Associated frontend repository - https://github.com/upendrakumbham/url-shortener-ui