A simple url shortener frontend and api using mongodb (will be remove to let backend and frontend repo come to life)
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Killian´Dal-Cin 0f671073f9 Add shop website 3 years ago
config First commit 3 years ago
models First commit 3 years ago
routes First commit 3 years ago
utils First commit 3 years ago
.env.example First commit 3 years ago
.gitignore Ignore .DS_Store 3 years ago
LICENSE First commit 3 years ago
README.MD Add shop website 3 years ago
docs.html First commit 3 years ago
index.html First commit 3 years ago
index.js First commit 3 years ago
package.json First commit 3 years ago

README.MD

MrKayJayDee Shortener

A simple url shortener frontend and api using mongodb


Setup

Clone the repo

git clone https://github.com/Mr-KayJayDee/simple-url-shortener

CD Into the directory

cd simple-url-shortener

Install the modules

npm install

Change the configuration

  • Rename the .env.example to .env
  • Change MONGO_URI to your mongodb local or cluster url
  • Change BASE to your base url (localhost:8080 for local testing)

Change some others things

Start the server

node index.js

API Reference

  POST /api/short
Body Type Description
origUrl string Required. The url you want to shorten

Returns

Key Type Description
urlId string The URL ID
origUrl string The original URL
shortUrl string The shortened URL
clicks number The amount of time this link has been clicked
date date The creation date of this link
_id string The databse id of this link
__v number The version number
{
  "urlId": string,
  "origUrl": string,
  "shortUrl": string,
  "clicks": number,
  "date": date,
  "_id": string,
  "__v": number
}

Example

  POST /api/short

Body:

{
    "origUrl": "http://google.com"
}

Returns:

{
    "urlId": "9bcF-giN0",
    "origUrl": "http://google.com",
    "shortUrl": "https://mrkayjaydee.xyz/9bcF-giN0",
    "clicks": 0,
    "date": "2022-01-26T15:37:26.977Z",
    "_id": "61f16ab602262b5f179d3336",
    "__v": 0
}

Contact Me: