Skip to content

About

This Project is used to create an API for create short url from given url.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

Golang URL Shortner

This Project is used to create the short url from given url.

Feature Overview

  1. Flat File Based Database
  2. API for create short URL
  3. API for get short URL information.
  4. Redirect short url into original url.

Guide

Installation

go get github.com/belekarpavan/urlshortner

Run

Go to the project directory. i.e workspace/src/github.com/belekarpavan/urlshortner/

go run main.go

API

1. /create :

This API is used to create the short url from given url.

Request body : {"url":"Your url"}

Example

URL          : http://localhost:8000/o/create

Request body : { "url" : "https://github.com/belekarpavan/urlshortner"}

Response     : {
                  "alias": "ZjVmYWE3ZT",
                  "originalURL": "https://github.com/belekarpavan/urlshortner",
                  "createdOn": "2021-08-11T09:38:04.5839015+05:30",
                  "shortURL": "http://localhost:8000/ZjVmYWE3ZT"
                }

2. /get :

This API is used to get the short url details.

Request body : {"url":"Your short URL"}

Example

URL          : http://localhost:8000/o/get

Request body : { "url" : "http://localhost:8000/ZjVmYWE3ZT"}

Response     : {
                  "alias": "ZjVmYWE3ZT",
                  "originalURL": "https://github.com/belekarpavan/urlshortner",
                  "createdOn": "2021-08-11T09:38:04.5839015+05:30",
                  "shortURL": "http://localhost:8000/ZjVmYWE3ZT"
                }

3. /urlAliase :

This API is used to redirect the orginal URL.

Example

  URL :  http://localhost:8000/ZjVmYWE3ZT
  
  It redirected to the https://github.com/belekarpavan/urlshortner URL.

image

image

About

This Project is used to create an API for create short url from given url.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

⌂ 换网址