Skip to content

Latest commit

 

History

History
70 lines (55 loc) · 998 Bytes

readme.md

File metadata and controls

70 lines (55 loc) · 998 Bytes

URL Shortening Service

A URL Shortening service built in go using the go-gin framework and MongoDB as the database.

Getting Started

These instructions will get you a copy of the project up and running.

Prerequisites

  • Docker

Setup

  1. Clone the repo:
git clone https://github.com/mhope-2/url-shortner.git
  1. Rename .env.sample to .env and update env variables accordingly
cp .env.sample .env
  1. Run with docker
docker-compose up

or

make up

Running tests

go test -v -cover ./...

or

make test

API

  • Endpoint: /short-link
  • Sample Requests
{
  "url": "https://gobyexample.com/random-numbers",
  "slug": "NTMyODk0"
}
{
  "url": "https://gobyexample.com/random-numbers"
}
  • Sample Response
{
    "result": {
        "shortened_url": "http://localhost:8085/NTMyODk0"
    }
}

Extras