emikobell / url-shortener

Shorten long URLs into more easily usable formats.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

URL Shortener

The URL Shortener is a CLI made to shorten long URLs into more easily usable ones. The app takes the URL, creates a key, converts the key to a base62 format, and returns the shortened version to the user. When the shortened URL is accessed, the server redirects users to the original URL!

URL Shortener CLI

The application also includes validation:

URL Shortener validation

Tech Stack

Backend

  • Java
  • Spring Boot
  • Spring Data MongoDB
  • Maven
  • MongoDB
  • JUnit (for testing)

Frontend

  • Javascript
  • Node.js
  • AJAX
  • Inquirer

Installation

Requirements

  • Node.js 20
  • Maven 3.9
  • JDK 20

Steps

Setting up the server:

  1. Clone the github repository.
git clone https://github.com/emikobell/url-shortener
  1. Create and connect your MongoDB database by creating an application.properties file under src/main/resources. The format should look like:
spring.data.mongodb.uri=mongodb+srv://<username>:<pwd>@<cluster>.mongodb.net/urldata
spring.data.mongodb.database=urldata
  1. Run the Spring Boot application.
mvn spring-boot:run
  1. If there are no exceptions, the server is now up!

  2. Navigate to cli and install the node dependencies in package.json:

cd cli
npm install
  1. Install the url-shortener CLI. The -g flag installs it globally (you can omit this if you would like).
npm install -g .
  1. Run the url shortener application.
url-shortener

Future features:

  • Docker containers

About

Shorten long URLs into more easily usable formats.


Languages

Language:Java 72.6%Language:JavaScript 27.4%