--- tags: golang, gin --- # Gin Introduction ## introduction Gin 是一個用golang寫的HTTP web框架 ## git repository [gin repo](https://github.com/gin-gonic/gin) ## Features 1 效能好 2 內建功能多 3 使用方便 ## prerequest 1 go version > 1.11 2 net/http package if 要使用一些HTTP status的constant 例如: httpStatusOK 等等 ## installation ```golang=== go get -u github.com/gin-gonic/gin ``` ## how to use ```golang=== package main // 引入 gin package import ( "github.com/gin-gonic/gin" "net/http" ) func main() { router := gin.Default() // Default 有一些 基礎 loginWrapper setup 還有 基本的 port router.GET("/info", func(c *gin.Context) { c.JSON(http.StatusOK, gin.H{ "message": "first gin server" }) }) router.run()// default port is 8080 if not setup } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up