Skip to content

GDSC-KIIT/divert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

divert

The internal URL shortening service for DSC KIIT. Available on link.dsckiit.in

Go Report Card

Get Started

Install the CLI tool to login and create short urls (only for members of DSC KIIT). The package is available on npm.

npm i -g @dsckiit/divert

This will setup the divert command, just run divert in your terminal. Ask for the login info from one of the team members

Tech and Design

The long and short urls are stored in the database. The backend fetches from the database every 3 minutes and updates a local in-memory hashmap that maps the short urls to long urls. The redirect requests are directly served by accessing this in-memory hashmap. We need that sweet O(1) access.

The process to fetch from the database runs on another thread (implemented using goroutines). sync.RWMutex is used to prevent data races on the hashmap.

The backend service is written in Go. The CLI tool is written in Typescript.

Backend Dependencies

  • github.com/dgrijalva/jwt-go v3.2.0
  • github.com/gorilla/mux v1.8.0
  • go.mongodb.org/mongo-driver v1.4.2

CLI Dependencies

  • axios
  • boxen
  • chalk
  • configstore
  • inquirer
  • ora

License

Copyright (c) DSC KIIT. All rights reserved. Licensed under the MIT License

forthebadge forthebadge