Skip to content

awkkih/shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

shortener ๐Ÿ”—

a simple and intuitive link shortener API. :D

how to install โ“

  1. clone the repository by using git clone https://github.com/eiyaxz/shortener.git.
  2. install the project's dependencies using npm install.
  3. run npm run start and use a tool like insomnia to make requests to the api.

Note

the default port is 3333. you can change that in src/server.ts.

endpoints ๐Ÿ”š

GET *

default catch-all route.

  • response (404):
    {
      "error": "Page not found"
    }

POST /short

creates a new short link.

  • body:

    {
      "url": "https://google.com/"
    }
  • response (201):

    {
      "short": "2796e032"
    }
  • response (400):

    {
      "error": "Invalid URL"
    }

GET /:short

finds the original link associated with the given code.
automatically redirects you to the associated page.

  • path parameters:
    short - the short's code.

  • response (404):

    {
      "error": "Short not found"
    }

About

A simple and intuitive link shortener API.

Topics

Resources

Stars

Watchers

Forks

Contributors