Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/irevenko/url-shortener
- Owner: irevenko
- License: mit
- Created: 2020-06-13T20:22:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-07-04T11:03:42.000Z (over 4 years ago)
- Last Synced: 2024-10-01T02:20:53.553Z (4 months ago)
- Topics: koa, koajs, mongodb, node, node-js, nodejs, tailwind, tailwind-css, tailwindcss, url-shortener, urlshortener
- Language: JavaScript
- Homepage:
- Size: 49.8 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)