how to hot reload for golang web application

Ubuntu TangUbuntu Tang
1 min read

There are tons of ways to hot reload a golang web application or golang program.

I choose gin to do the hot reload.

Firstly install the gin in GOPATH/bin:

go get github.com/codegangsta/gin

Basic usage

If we run a gin( the same name, but it is the web framework gin) web application which is listening to 8080, we can run this command as below:

go run main.go —port=8088 —appPort=8080

The “—port “ mean the gin proxy server would listen to the port.And the “—appPort” is the port for the Go web server, in this case, we listen to 8080.

0
Subscribe to my newsletter

Read articles from Ubuntu Tang directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ubuntu Tang
Ubuntu Tang

A developer for fullstack.