GithubHelp home page GithubHelp logo

aaravmehta59 / zippy Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 37 KB

Zippy is a minimalist and efficient URL shortening service designed for simplicity and speed.

License: Other

JavaScript 96.79% Batchfile 3.21%

zippy's Introduction

Zippy URL Shortening API Documentation

Zippy is a minimalist and efficient URL shortening service designed for simplicity and speed. This documentation provides a comprehensive guide on how to use the API for shortening long URLs into clean and shareable links.

Production URL

An Instance haven't been made live untill now. You can host it as per your needs!

Self-Hosting

  • Requirements:

    • Node.js: Version 14 or higher
    • NPM: Version 9 or higher
  • Getting latest files:

    • Using Git: Type git clone https://github.com/AaravMehta59/zippy.git in your terminal.
    • Mannual Labour: Download the latest zip, and upzip it in your desired location.
  • How to start on your machine

    • Windows: Open start.bat on your computer and let the magic happen! The server will start on port 3000
    • Other OS: Open your terminal and type npm install && node index.js and run it! The server will start on port 3000

API Endpoints

Endpoint: POST /shorten

  • Description: Shorten a long URL into a compact, shareable link.

  • Request:

    • Method: POST
    • Endpoint: /shorten
    • Request Body:
      • url (string, required): The original URL to be shortened.
      • shorturl (string, optional): A custom short URL, if desired.
      • randomUrl (string: true or false, optional): Generates a random short URL, if specified true.
  • Response:

    • Success (HTTP 200 OK):
      • JSON response with the shortened URL information.
    • Error (HTTP 400 Bad Request or 500 Internal Server Error):
      • JSON response with an error message.
  • Example 1: For Custom ShortURL:

    • Request:

      {
        "url": "https://example.com",
        "shorturl": "mycustomshorturl"
      }
    • Response:

      {
        "message": "Short URL created successfully",
        "original_url": "https://example.com",
        "short_url": "https://localhost:3000/mycustomshorturl"
      }
  • Example 2: For Random Short URL:

    • Request:

      {
        "url": "https://example.com",
        "randomUrl":"true"
      }
    • Response:

      {
        "info": "Short Url created successfully",
        "original_url": "https://example.com",
        "short_url": "https://localhost:3000/8ae6de"
      }

Endpoint: GET /:url

  • Description: Redirect to the original URL associated with the provided short URL.

  • Request:

    • Method: GET
    • Endpoint: /:url
    • URL Parameter:
      • url (string, required): The short URL to redirect.
  • Response:

    • Success (HTTP 302 Found):
      • Redirects to the original URL associated with the short URL.
    • Error (HTTP 404 Not Found):
      • JSON response with an error message if the short URL is not found.
  • Example:

    • Request:
      • Accessing https://localhost:3000/mycustomshorturl will redirect to the original URL associated with the short URL.

Endpoint: GET /

  • Description: A simple welcome message for the LinkZip service.

  • Request:

    • Method: GET
    • Endpoint: /
  • Response:

    • Success (HTTP 200 OK):
      • A plain text response containing the welcome message.

zippy's People

Contributors

aaravmehta59 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.