Skip to content

Latest commit

 

History

History
74 lines (61 loc) · 1.38 KB

README.md

File metadata and controls

74 lines (61 loc) · 1.38 KB

Turl - tiny URL shortener

Run

git clone https://github.com/fredeastside/turl.git ./turl
cd turl
make start

Try to send curl requests.

Tech stack

  1. Go
  2. PostgreSQL
  3. Apache Kafka
  4. Docker

Dependencies

  1. Router - github.com/gin-gonic/gin
  2. Logger - github.com/sirupsen/logrus
  3. Kafka client - github.com/Shopify/sarama
  4. Unique ID generator - github.com/speps/go-hashids

Endpoints

  1. Create short URL
curl -X POST "http://0.0.0.0:8080/api/v1/" -d "url=https://google.com" -H "Content-Type: application/x-www-form-urlencoded"
  1. Get redirected URL
curl -X GET "http://0.0.0.0:8080/api/v1/gJWG"

How it works Schema

  1. Get daily, weekly, all days report
curl -X GET "http://0.0.0.0:8080/api/v1/gJWG/report"

Credentials and settings

Please, find it in .env file

APP_PORT=8080
WORKER_PORT=8081
DB_NAME=mydb
DB_USER=myuser
DB_PASSWORD=mysecretpassword
DB_PORT=5432
DATABASE_URL=postgres://myuser:mysecretpassword@db/mydb?sslmode=disable
GIN_MODE=release
ZOOKEEPER_PORT=2181
KAFKA_HOST=kafka
KAFKA_PORT=9092
UID_SALT=6.2Wghz6TjiH8_m)iErw3BDlR+dbI2Z!jfkH
UID_MIN_LEN=4

Tests

make test

Up/Stop

make up
make stop