@dsckiit/divert

1.1.0 • Public • Published

divert

The internal URL shortening service for DSC KIIT. Available on r.dsckiit.gq

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 install the divert command, just run divert in your terminal to start the cli tool.

Tech and Design

The long and short urls are stored in the database. The backend fetches 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 in memory 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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    1
    • latest

Version History

Package Sidebar

Install

npm i @dsckiit/divert

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

89 kB

Total Files

10

Last publish

Collaborators

  • saswatamcode
  • junaidrahim