/shortener

A simple URL shortening service.

Primary LanguageTypeScript

Shortener

A simple URL shortening service.

Project

Used tools:

This service saves a short URL for 7 days.

Routes

POST:

  • /a/create

Example using HTTPie:

http POST localhost:3000/a/create url="https://github.com/LuisHenriqueFA14"

Return:

{
    "id": "d3969cdd-d931-487c-9ed1-85316b894902",
    "origin": "https://github.com/LuisHenriqueFA14",
    "short": "rxra15uj3c"
}

GET:

  • /p/:page

Example using HTTPie:

http GET localhost:3000/p/rxra15uj3c

Return:

Found. Redirecting to https://github.com/LuisHenriqueFA14

In the browser, it redirects to the original URL.

Install

Install the dependencies:

yarn --prod
# or
npm i --prod 

Build the TypeScript files:

yarn build
# or
npm run build

Run the project:

yarn start
# or
npm run start

Installing for development:

Install the dependencies:

yarn
# or
npm i

Run the project:

yarn dev
# or
npm run dev