Thanks to visit codestin.com
Credit goes to github.com

Skip to content

This is a backend service for shortening URLs. Users can provide a long URL, and the service generates a unique short URL. When someone visits the short URL, they are redirected to the original long URL. The backend is built using Node.js, Express, and MongoDB (via Mongoose).

Notifications You must be signed in to change notification settings

MirajMalik/URL_Shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

URL Shortener Service

Overview

This is a backend service for shortening URLs. Users can provide a long URL, and the service generates a unique short URL. When someone visits the short URL, they are redirected to the original long URL. The backend is built using Node.js, Express, and MongoDB (via Mongoose).

Features

  • Shorten long URLs into a unique short URL.
  • Store URLs and visit history in MongoDB.
  • Keep track of timestamps for each visit.
  • Fast and lightweight backend API for URL shortening.

Tech Stack

  • Node.js
  • Express.js
  • MongoDB & Mongoose
  • shortid (for generating unique short URLs)

Implementation Details

  1. Short URL Generation:

    • Each long URL is assigned a unique shortId using the shortid library.
    • The shortId is stored along with the original URL in MongoDB.
  2. Database Schema:

    • The URL schema has three main fields:
      • shortId: Unique identifier for the short URL.
      • redirectUrl: The original URL to redirect to.
      • visitHistory: Array storing timestamps of each visit.
    • Timestamps are automatically managed using Mongoose’s "timestamps" option.

URL_Shortener

About

This is a backend service for shortening URLs. Users can provide a long URL, and the service generates a unique short URL. When someone visits the short URL, they are redirected to the original long URL. The backend is built using Node.js, Express, and MongoDB (via Mongoose).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published