Skip to content

amelekhin/shortly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shortly

A small URL shortening service. Demo: shortly.deno.dev.

Endpoints

POST /api/v1/link/encode

Params:

type EncodeRequest = {
  /**
   * An original URL that needs to be shortened.
   * Must be compliant with the URL spec.
   *
   * @link https://url.spec.whatwg.org/
   */
  originalURL: string;
};

Response:

type EncodeResponse = {
  /**
   * An original URL.
   * Must be compliant with the URL spec.
   *
   * @link https://url.spec.whatwg.org/
   */
  originalURL: string;

  /**
   * An shortened URL that redirects to the originalURL.
   * Must be compliant with the URL spec.
   *
   * @link https://url.spec.whatwg.org/
   */
  shortURL: string;
};

Error codes:

  • MISSING_ORIGINAL_URL - no original URL is provided
  • INVALID_ORIGINAL_URL - the provided URL is not compliant with the URL spec

GET /api/v1/link/decode

Params:

type DecodeRequest = {
  /**
   * An shortened URL that redirects to the originalURL.
   * Must be compliant with the URL spec.
   *
   * @link https://url.spec.whatwg.org/
   */
  shortURL: string;
};

Response:

type DecodeResponse = {
  /**
   * An original URL.
   * Must be compliant with the URL spec.
   *
   * @link https://url.spec.whatwg.org/
   */
  originalURL: string;

  /**
   * An shortened URL that redirects to the originalURL.
   * Must be compliant with the URL spec.
   *
   * @link https://url.spec.whatwg.org/
   */
  shortURL: string;
};

Error codes:

  • MISSING_SHORT_URL - no short URL is provided
  • INVALID_SHORT_URL - the provided URL is not compliant with the URL spec
  • NO_SUCH_SHORT_URL - the original URL corresponding to the given short URL is not found in the registry

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published