Flask Shorten

A super simple flask app that exposes a RestAPI for generating shorten url links

Basic Interface Example


Low Level Usage

Swagger/OpenAPI documentation can be found here Generating a random url.

        curl -X POST \
            http://link.jtmiclat.me/url/ \
            -H 'Content-Type: application/json' \
            -d '{"url": "http://google.com"}'
        # {
        #     "path": "UL35kEMC",
        #     "url": "http://google.com"
        # }
    
Checking if the path generated actually forwarded

        curl -i -X GET http://link.jtmiclat.me/UL35kEMC  | grep Location
        # Location: http://google.com
    
You can preset the urls by passing custom_path field in the json body

        curl -X POST \
            http://link.jtmiclat.me/url/ \
            -H 'Content-Type: application/json' \
            -d '{"url": "http://github.com", "custom_path": "GitHub"}'
        # {
        #     "path": "Github",
        #     "url": "http://github.com"
        # }
    

        curl -i -X GET http://link.jtmiclat.me/GitHub  | grep Location
        # Location: http://github.com
    

Code

Code can be found here

Warning

This website was meant as an example on how deploy the app and not be used as a real service. I do not guarantee that the data will always be persisted and be accurate.