hi-manshu / ktor-url-shortener

This is a Ktor project to build your own Url shortener

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ktor URL Shortner

Twitter

This project is a implementation for creating Short URL using Ktor + Kotlin + MongoDB

alt text

Usage

It contains two routes if you want to implement it in Client side.

POST - /v1/url

This takes the request,


{
    "url":"your_long_url"
}

GET - /{url}

This will take the short URL as path param and will redirect you to the main original URL

Frontend

It also has a frontend module built using kotlin.html and you can find it in frontendRouting

Points

  • By passing a valid URL we can create a short URL of 6 alpha-numerics.
  • If validates the URL before creating the short URL
  • If the provided URL is present in the Database, it will return back the initial Short URL created in place of creating a new one.
  • When the GET short URL is called, we also update the hit count to that short URL.

How to run the project?

  • Clone the project.
  • Make sure MongoDB is installed.
  • Start the MongoDB
  • Play around with the project.

To read more about it

About

This is a Ktor project to build your own Url shortener


Languages

Language:Kotlin 100.0%