Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/irevenko/url-shortener

✂️ Service for Shortening links using Node.js
https://github.com/irevenko/url-shortener

koa koajs mongodb node node-js nodejs tailwind tailwind-css tailwindcss url-shortener urlshortener

Last synced: 4 months ago
JSON representation

✂️ Service for Shortening links using Node.js

Awesome Lists containing this project

README

        

# Cherry URL Shortener ✂️
Red, Cherry 🍒 Themed Web Service for Shortening urls

# How it works ❓
For example: we have our inital link which we need to short - ```github.com```

And we have our domen which is for instance - ```short.me```

We generate a unique token for our URL and save it into DB. In my case i used [shortid](https://www.npmjs.com/package/shortid) library to generate it for me

And we get a token - ```1kDdvurHW```. Then we have to hookup this token to our domen

After this we compose our short URL by adding token after domen - ```short.me/1kDdvurHW```

If URL is in DB we return it to user, Else we just create a new one by assembling our ```domen``` and ```token``` together.

Finally when user enters this URL we redirect him to our initial site by checking the token from the DB and comparing it to our URL. ```short.me/1kDdvurHW -> github.com```

So our DB Schema has URL collection which contains: ```Full URL, URL Token, Short URL```

And we store our Full URL together with unique URL Token

# Technologies 🧾
* Node.js
* koa
* shortid
* mongoose
* Tailwind CSS

# Preview 🔍

# Quick Start 🚀
```git clone https://github.com/irevenko/url-shortener.git```

```cd url-shortener/src```

```npm install```

```touch .env (Add your variables)```

```node app.js```

# What I Learned 🧠
* koa, koa-router, koa-bodyparser
* ejs Engine
* MongoDB

# ToDo
* Deploy on Heroku

# License 📑
(c) 2020 Ilya Revenko. [MIT License](https://tldrlegal.com/license/mit-license)