Skip to content

Latest commit

Β 

History

History
85 lines (57 loc) Β· 1.65 KB

readme.md

File metadata and controls

85 lines (57 loc) Β· 1.65 KB

URL Shortener βœ‚οΈ

Description πŸ™

This is a minimalistic web service that shortens an URL. This service saves the original and shortened URLs in a Redis database for quick retrieval. The project leverages a minimal API style using .NET to ensure a clean and efficient codebase.

Tech Stack πŸ“

logos of dotnet, docker and redis

Instructions to Run πŸ§‘β€πŸ’»

Prerequisites

  • Docker installed on your machine.

Steps to Run

  1. Clone the Repository

    git clone <repository-url>
    cd url-shortener
  2. Build and Run the Docker Containers

    Use Docker Compose to build and start both the URL Shortener API and Redis containers.

    docker-compose up --build
  3. Access the API

    Once the containers are up and running, the URL Shortener API will be accessible at:

    http://localhost:3001
    

API Endpoints

  • Shorten URL

    POST /shorten
    

    Request Body:

    {
      "url": "https://example.com"
    }

    Response:

    {
      "message": "success",
      "shortUrl": "http://localhost:5000/abc123"
    }
  • Redirect to Original URL

    GET /{shortUrl}
    

    Accessing the shortened URL will redirect to the original URL.

Stopping the Containers

To stop the running containers, use:

docker-compose down