GoLang / Setup / install Go Lang
Install Go lang
-
Steps
Step 1
1. Go to https://go.dev/doc/install
2. Download exe
3. Run exe
4. Check version , open cmd window
go version Step2: Create a folder for your code
1. change folder
cd %HOMEPATH% 2. create new folder
$ mkdir web-service-gin $ cd web-service-gin Step 3: gin package
go mod init example/web-service-gin Step 4 : create main.go
package main import ( "net/http" "github.com/gin-gonic/gin" ) func main() { router := gin.Default() router.GET("/albums", getAlbums) router.Run("localhost:8080") } Step 5 : download dependency
go get . Step 6 : run the code
go run . Step 7 :send http request
$ curl http://localhost:8080/albums