Skip to content

WiFeng/short-url

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

short-url

Rest api

  • admin/create

        curl --location --request POST 'http://127.0.0.1:8081/admin/create' \
            --header 'Content-Type: text/plain' \
            --data-raw '{
                "long_url" : "https://github.com/wifeng/leetcode"
            }'
        {
            "short_url": "http://sh.url/2bI"
        }
  • admin/query

        curl --location --request POST 'http://127.0.0.1:8081/admin/query' \
            --header 'Content-Type: text/plain' \
            --data-raw '{
                "short_url" : "2bI"
            }'
        {
            "long_url": "https://github.com/wifeng/leetcode"
        }

Redirect

Request

    http://sh.url/2bI

Response

    HTTP/1.1 302 Found
    Content-Type: application/json; charset=utf-8
    Location: https://github.com/wifeng/leetcode
    Date: Mon, 01 Jun 2020 05:28:03 GMT
    Content-Length: 0

About

Convert the long URL to short URL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages