Skip to content

tsugent/link_shortener_go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Link Shortener

A simple link shortener written in GO

Features

  • Makes links shorter

Prerequisites

Setup

Follow these steps to set up the project locally.

  1. Clone the repository:

    git clone https://github.com/tsugent/link_shortener_go.git
  2. Navigate to directory:

    cd ./link_shortener_go/
  3. Build/Run Production:

    go build -o go-url-short .
    ./go-url-short

    Development:

    go run .

Usage

  1. Create a Shortened Link:

    #POST:

    curl -X POST localhost:8080/shorten -d '{"originalURL": "https://facebook.com", "created": "10/19/2021 10:19:01"}' 

    #STDOUT:

    "{\"shortened_link\": \"http://localhost:8080/short/?r=e70f7e67\"}"
  2. Retrieve URL to be directed to:

    #GET:

        curl -X GET "http://localhost:8080/short/?r=e70f7e67" 

    #STDOUT:

        "{\"original_url\": \"https://facebook.com\"}"

Contributing

I don't know why you'd do something like that.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages