/url-shortener

A URL shortener created with TypeScript

Primary LanguageTypeScriptMIT LicenseMIT

🌐 URL Shortener

A functional URL shortener made with TypeScript

📌 Installation

Using yarn to install all dependencies

yarn

Compile TypeScript to Javascript

yarn build:watch

To run the server

yarn dev

📝 How to Use

Create a .env file and set these environment variables

MONGO_CONNECTION=Your mongodb uri
API_URL=Your server address(ex: http://localhost:5500) 
PORT=Some valid port in your system (default is 5500)

Routes

  • [POST] API_URL/shorter

    Curl

    curl -XPOST -H "Content-type: application/json" -d '{ "originUrl": "http://www.example.com"}' "http://localhost:5500/shorter"
    
  • [GET] /:hash You must give a valid hash as a param, you can get it creating a shortened url

🔖 Project Responsibilities

  • Create a URL shortener
  • Redirect the original site

ℹ️ Motivation

I was rusty programming, so i decided to create a simple project to practice some typescript and node tools.

✋ Contributions

You can open an issue or send me a email

📜 License

MIT