Skip to content

kanavbajaj/URL-Shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

URL Shortener

Overview

This project is a URL shortener built using Node.js, Express.js, and MongoDB. It allows users to shorten long URLs into concise links for easy sharing.

Prerequisites

  • Node.js and npm (or yarn)
  • MongoDB
  • A code editor

Installation

  1. Clone the repository:
    git clone https://github.com/kanavbajaj/URL-Shortener.git
  2. Navigate to the project directory:
    cd url-shortener
  3. Install dependencies:
    npm install

Running the Application

  1. Start the MongoDB server.
  2. Run the application:
    npm start

The application will be accessible at http://localhost:your_port_number.

API Endpoints

  • POST /shortUrls
    • Request body:
      {
        "fullUrl": "https://www.example.com/long-url"
      }
    • Response:
      {
        "short": "http://localhost:your_port_number/shortened-url"
      }
  • GET /:shortUrl
    • Redirects to the original URL.

Database Structure

The MongoDB database will contain a collection with the following schema:

{
  "full": "https://www.example.com/long-url",
  "short": "shortened-url",
  "clicks": "Number Of Clicks"
}

Contributing

Contributions are welcome! Please open an issue or pull request if you have any improvements or new features.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published