Go 언어 환경을 만들어 보았습니다(Gin으로 HTTP 서버 구축).
환경
환경 구축
Windows 측면 작업
vagrant up
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.network "private_network", ip: "192.168.33.20"
end
vagrant ssh
SSH를 VM에 연결고객 운영 체제 측면 작업
※ Vagrantfile로 정리하면 되는데...
yum update
sudo yum install git
(설치 후 Gin 필요)$ curl -OL https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz
$ sudo tar -C /usr/local -xzf go1.12.5.linux-amd64.tar.gz
$ export PATH=$PATH:/usr/local/go/bin
$ mkdir hello-world
$ cd hello-world/
$ sudo vi main.go
$ go build
$ ./hello-world
main.gopackage main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
↓↓ 결과HTTP 서버로 시작 시도
설치Gin
$ go get -u github.com/gin-gonic/gin
package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
r.Run() // listen and serve on 0.0.0.0:8080
}
$ go build
$ ./hello-world
↓↓↓ 서버 시작→ 잘 방문할 수 있다
↓ 서버 측 로그
로그μ초 단위로 처리 속도에 자신 있는 것 같아요.(웃음)
Reference
이 문제에 관하여(Go 언어 환경을 만들어 보았습니다(Gin으로 HTTP 서버 구축).), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/teracy164/items/14d92d1cef3d85df48f0텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)