Skip to content

mhope-2/url-shortener

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published