All Projects → hi-manshu → ktor-url-shortener

hi-manshu / ktor-url-shortener

Licence: other
This is a Ktor project to build your own Url shortener

Programming Languages

kotlin
9241 projects

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].