Skip to content

You can Short your url, you can add custom length and you can add desired alias or name to url

Notifications You must be signed in to change notification settings

eraltafs/urlshortner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

URL Shortner

deloyed link

Description

You can Short your url, you can add custom length and you can add desired alias or name to url

Backend

for local run

Installation

  1. Clone the repository:

    git clone https://github.com/eraltafs/urlshortner

Pre - requisites

Before running the application, make sure you have the following installed:

  • Node.js
  • MongoDB

chage the directory

cd .\server\

Install the dependencies:

npm install

set the environment

  • create .env file in server and make two variables
    • mongoURL = "<your_mongo_DB_url>"
    • PORT = <Your_Port_Number>

Start the server:

 npm start

The server will start running on the specified port.

API Endpoint

To get base API

* method : GET
* Endpoint : /


* Response:
  data: { msg: "Base Api" }

To short URL

method: "POST",
* Endpoint : /shortUrl

headers: {
  "Content-Type": "application/json",
},
body: JSON.stringify({
  url: <Original_URL>,
  length: <length>,
  alias: <custom_alias>,
}),

* Response:
  data: { short_url: shortenUrl }

To redirect URL

method: "GET",
* Endpoint : /:randomstring

* Response:
  redirected if shorturl find

change api index.js in client

  • let api = "https://<your_api>.com";

Frontend

Tech Stacks

Frontend

Backend



Features

Project Highlights

About

You can Short your url, you can add custom length and you can add desired alias or name to url

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published