Skip to content

zehan12/URL-Shortner

Repository files navigation

URL SHORTNER

URL shortening is a technique on the World Wide Web that enables the Uniform Resource Locator to be made considerably shorter and still direct to the desired page. This is done by using a redirect path to a web page that has a long URL.

Live Link

https://url-shortner-zehan12.vercel.app/

Usage

When the user enters the link, a short link will appear. Use clipboard emote to copy the link. The link will redirect you to the original link.

It has been deployed on Render.com . If you want then you can buy a domain and connect it with the render.com as well. This will shortner the link even more.

Installation

  1. Clone this repo git clone https://github.com/zehan12/url-shortner

  2. Install npm packages yarn add

  3. Start the project yarn start

Screenshots

  1. Home Page

image

  1. Entered the link in the text field and clicked submit

image

  1. Short Link Generated

image

click to navigation to vist the link or copy to cilpboard

Endpoints

CREATE URL

POST /api/url/short/

Example request body:

{
 '{"data":{"click":"0","createdAt":"2022-11-27T09:36:04.916Z","originalUrl":"https://medium.com/@zehan9211/the-inception-of-tailwind-css-in-create-react-app-with-yarn-46c958a0b339","shortUrl":"https://url-e30t.onrender.com/8de6gj","updatedAt":"2022-11-27T09:36:04.916Z","urlCode":"8de6gj","__v":0,"_id":"63832f84ae896fb1ae662443"}}'
}

Required fields: originalUrl.

GET ALL

GET /api/url/show

Example request body:

{
  [
   {
    click: 0
    createdAt: "2022-11-27T09:36:04.916Z"
    originalUrl: "https://medium.com/@zehan9211/the-inception-of-tailwind-css-in-		create-react-app-with-yarn-46c958a0b339"
    shortUrl: "https://url-e30t.onrender.com/8de6gj"
    updatedAt: "2022-11-27T09:36:04.916Z"
    urlCode : "8de6gj"
    __v: 0
    _id: "63832f84ae896fb1ae662443"
 	}
  ]
}

Required fields: null

DELETE URL

GET /api/url/short/:code

Example request body:

{
  "data":
    {
      click: 0
   	createdAt: "2022-11-27T09:36:04.916Z"
   	originalUrl: "https://medium.com/@zehan9211/the-inception-of-tailwind-css-in-create-react-app-with-yarn-46c958a0b339"
  	   shortUrl: "https://url-e30t.onrender.com/8de6gj"
  		updatedAt: "2022-11-27T09:36:04.916Z"
      urlCode : "8de6gj"
   	__v: 0
      _id: "63832f84ae896fb1ae662443"
  }
}

Required fields: code