Short Url

Microservice node API featuring NextJs and mongoDB to shorten long url

Demo

Installation

  1. clone this repository
git clone https://github.com/robdll/short-url
  1. move to the project directory and install dependecies
cd short-url
yarn
  1. run locally
yarn dev
  1. visit http://localhost:3000 with your browser to see the result.

API usage

POST endpoint

<projecturl>/api/shorturl

Request body

json object containing the following key/value

url: a valid url

example: { url: "https://www.google.com" }

Response

json object containing the following key/value

original_url: original user url
short_url: id of the url

Response example

{
    "original_url":"www.google.com",
    "short_url": 650
}

Short url can is now available via GET request to the url [projectURL]/api/shorturl/10

Deploy

The easiest way to deploy your Next.js app is to use the Vercel Platform

Check out Next.js deployment documentation for more details.