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.
https://url-shortner-zehan12.vercel.app/
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.
-
Clone this repo git clone https://github.com/zehan12/url-shortner
-
Install npm packages yarn add
-
Start the project yarn start
- Home Page
- Entered the link in the text field and clicked submit
- Short Link Generated
click to navigation to vist the link or copy to cilpboard
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 /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
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