Skip to content

Latest commit

 

History

History
40 lines (25 loc) · 1.02 KB

README.md

File metadata and controls

40 lines (25 loc) · 1.02 KB

短網址

利用 Flask、Redis、MySQL 透過 RestFulAPI 的方式實現建立短網址、刪除、轉址的功能

部屬方式

  1. 直接使用

    port預設為5000

    py ./app.py
  2. Docker Compose

    透過docker-compose.yml的設定

    已經把flask從port 5000轉發到port 80上

    docker compose up

Demo

  1. Create

    curl -X POST -H "Content-type: application/json" -d '{"url":"https://www.facebook.com/","expireAt":"2024-08-30T09:20:41Z"}' 'http://localhost:port/api/v1/urls' image

  2. Redirect

    curl -L -X GET -i http://localhost:port/3Lr6vWrIL9xBblu image

  3. Delete

    curl -X DELETE -i http://localhost:port/api/v1/urls/3Lr6vWrIL9xBblu image