Skip to content

gdsc-nits-org/proto-shorturl-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prototype for URL Shortening service for GDSC NITS

This project is a URL shortener built with Express.js, Prisma, and MongoDB. It allows users to shorten long URLs into more manageable and shareable links.

Getting Started

Prerequisites Node.js (>= version 14) MongoDB (Make sure MongoDB is installed and running)

Installation

Clone the repository:

  git clone https://github.com/gdsc-nits-org/proto-shorturl-backend.github

Change into the project directory:

  cd proto-shorturl-backend

Install dependencies:

   npm install

Create a '.env' file in the root directory and set the following environment variables:

   PORT=3000
  DATABASE_URI=mongodb://localhost:3000/proto-shorturl-backend

Adjust the 'PORT' and 'DATABASE_URI' values as needed.

Database Setup

  1. Ensure that your MongoDB server is running.
  2. Create a database named 'url-shortener' (or the name specified in your '.env' file).

API Endpoints

  1. Method : POST
  2. Endpoint: /api/shorten
  3. Body:
{
  "url": "https://example.com"
}
  1. Responses:
{
  "originalUrl": "https://example.com",
  "shortUrl": "http://localhost:3000/abc123"
}

Redirect to Original URL:

  1. Endpoint: GET /:shortCode
  2. Redirects to the original long URL associated with the provided short code.

Contributing

Contributions are always welcome!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •