A URL Shortener Microservice developed using Spring Boot and MongoDB, which is used to shorten the Long URL into Shorten URL. It provides REST API endpoints to interact with.
Full Stack Project with React and Spring Boot where this project is used as a backend.
- Clone the project
git clone https://github.com/animesh-anand-dev/URL-Shortener-Microservice.git
-
Download Spring Tool Suite or Eclipse IDE open the Parent Folder using any of thse IDE as workspace.
-
Import the Cloned project in IDE.
-
Create and Setup account for MongoDB Atlas on MongoDB Cloud.
-
Create User and Password for the Database.
-
Create Database
-
Go to application.properties file
-
Replace the value of key spring.data.mongodb.uri and spring.data.mongodb.database which is your coonection string and database name respectively.
-
Now Run your project as Spring Boot App
-
Open your favourite API testing tool like Postman for desktop and Talend API Tester
😊 Happy Coding 🎉
GET /urls
http://localhost:5000/urls
GET /${id}/details
http://localhost:5000/random_id/details
Parameter | Type | Description |
---|---|---|
id |
string |
Required. Id of Shorten Url to fetch details |
POST /urls
http://localhost:5000/urls
Request body | Type | Description |
---|---|---|
originalUrl |
string |
Required. originalUrl of Long URL to create shorten link. |
GET /${id}
http://localhost:5000/random_id
- Spring Web Build web, including RESTful, applications using Spring MVC. Uses Apache Tomcat as the default embedded container.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
- Spring Data MongoDB Store data in flexible, JSON-like documents, meaning fields can vary from document to document and data structure can be changed over time.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
- Guava: Google Core Libraries For Java Guava is a suite of core and expanded libraries that include utility classes, Google's collections, I/O classes, and much more.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
</dependency>
- Apache Commons Validator Apache Commons Validator provides the building blocks for both client side validation and server side data validation. It may be used standalone or with a framework like Struts.
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.7</version>
</dependency>
- SpringDoc OpenAPI Starter WebMVC UI The springdoc-openapi generates API documentation as per OpenAPI 3 specification. Moreover, it also handles the Swagger UI configuration for us, making API document generation a fairly simple task.
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.0</version>
</dependency>
- Spring Boot Starter HATEOAS Starter for building hypermedia-based RESTful web application with Spring MVC and Spring HATEOAS.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
- Spring Boot DevTools Provides fast application restarts, LiveReload, and configurations for enhanced development experience.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
- Website: https://animeshanand.web.app/
- Github: @animesh-anand-dev
- LinkedIn: https://linkedin.com/animeshanand
Give a ⭐️ if this project helped you!
Copyright © 2023 Animesh Anand.
This project is MIT License licensed.