Skip to content

TenzingT-Lama2001/URL-Shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gotrim

Go Trim

Your URL Shortening Solution.

live

Live

The site is live on:

Getting started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

What things you need to install the software and how to install them :


Installation

  1. Clone the git repository

    git clone https://github.com/TenzingT-Lama2001/URL-Shortener.git
  2. Go into the project directory

    cd URL-Shortener/
  3. Install dependencies

    go mod tidy
  4. Copy .env.example to .env

    DOMAIN = "your-backend-url"
  5. Run the program

    go run main.go
  6. Run the test

    go test -v ./...

Endpoints

/shorten

Description

Accepts a JSON payload with a long URL and returns a short URL.

  • Method: POST
  • Path: /shorten
  • Body: longURL (string): The long URL to be shortened.
  • Headers:
    • Content-Type: application/json
{
  "longURL": "https://github.com/TenzingT-Lama2001/URL-Shortener"
}

/{shortCode}

Description

Redirects users to the original long URL based on the short code provided.

  • Method: GET
  • Path: /{shortCode}
{
    "shortURL": "http://localhost:3000/cCZAGC"
}

Releases

No releases published

Packages

No packages published

Languages