/slicer-fun

SLICER | URL Shortener

Primary LanguageJavaScriptMIT LicenseMIT

SLICER | URL Shortener

alt text

It is a URL shortener to get shortened URLs.

Used Tecnologies

  • Heroku(Hosting)
  • MongoDB(Database)
  • NodeJS(Serving HTML files and API)

Usage

A youtube tutorial here: SLICER | Easiest URL Shortener - Kaan Ersoy

Install

Clone the project with:

$ git clone https://github.com/kaanersoy/slicer-fun.git

Go to path of project

$ cd projectpath && npm install

Fill the env variables

DB_URL=example.url
PORT=1523

Run the project

# for developer mode
$ npm run dev
# for production mode
$ npm run start

API Usage

API URI: https://www.slicer.fun

Create Shortened URL

slug is optional, you can generate random slugs if you don't send slug.

Example Request:

fetch('https://www.slicer.fun/url', {
  method: 'POST',
  headers: {
    headers: {
      'Content-Type': 'application/json'
    },
  }
  body: JSON.stringify({
    url: 'https://google.com',
    slug: 'google' // optional
  })
})

Response:

{
  "_id": "60ab36s7b1ee4cc2dd9e3b576",
  "url": "https://google.com",
  "slug": "google"
}

Redirection:

Just do a simple get request from client.

Example:

https://slicer.fun/:slug