Golang Gin

動手練習,並製作筆記

靜態文件處理

存放目錄

./static

image

/

GET

回傳

{"message":"Hi"}

image

/login

GET

image

POST

image

/json

GET

回傳

{"age":20,"message":"Hello Golang","name":"IvesShe"}

image

/more_json

GET

回傳

{"name":"ChiChi","message":"Hello World","age":18}

image

/web

GET

回傳

{"age":"","message":"Hi","name":"18"}

image

/blog/:name/:age

GET

輸入 ex

http://localhost:9090/blog/iveshe/20

回傳

{"age":"20","name":"iveshe"}

image

/user

GET

輸入 ex

http://localhost:9090/user?username=IvesShe&password=123456

回傳

{"status":"ok"}{"username":"IvesShe","password":"123456"}

image

/form

POST

回傳

{
    "status": "/form POST ok"
}{
    "username": "ivesshe",
    "password": "111111"
}

image

/json

POST

回傳

{
    "status": "/json POST ok"
}{
    "username": "ivesshe",
    "password": "111111"
}

image

/upload

GET

image

image

POST

image

/upload_more

  • /upload GET image

  • upload_more POST

{"message":"3 files uploaded!"}

image

上傳成功

image

/turn_this

轉向turn_that

/turn

輸出

{"message":"turn_that"}

image

/shop

GET

輸出

{"method":"GET"}

image

POST

輸出

{
    "method": "POST"
}

image

PUT

輸出

{
    "method": "PUT"
}

image

DELETE

輸出

{
    "method": "DELETE"
}

image

/book

同/shop

/video

shop

輸出

{"method":"/video/shop"}

image

login

輸出

{"method":"/video/login"}

image

user

輸出

{"method":"/video/user"}

image

/member

輸出

{"msg":"使用了ShowHandler中間件..."}{"message":"member"}

image

image