Skip to content

Latest commit

 

History

History
71 lines (47 loc) · 1.38 KB

File metadata and controls

71 lines (47 loc) · 1.38 KB

URL Shortener

This is a URL shortener built using Go. The main objective was to learn how to use the Hexagonal Architecture. The service currently supports the following databases

Run Locally

Clone the project

  git clone [email protected]:jwambugu/hexagonal-architecture-url-shortner.git

Go to the project directory

  cd hexagonal-architecture-url-shortner

Set the environment variables (Redis)

  export MS_REPOSITORY=redis
  export REDIS_URL=redis-url-goes-here

Set the environment variables (MongoDB)

  export MS_REPOSITORY=mongo
  export MONGO_URL=mongo-url-goes-here
  export MONGO_DB=redirects

Start the server

  go run main.go

API Reference

Get Shortened URL

  GET /{code}
Parameter Type Description
code string Required.

Shorten URL

  POST /
Parameter Type Description
url string Required. URL to shorten

References