tower
tower copied to clipboard
Hot compile for web app in golang
Tower
Tower makes your Go web development much more dynamic by monitoring file's changes in your project and then re-run your app to apply those changes – yeah, no more stopping and running manually! It will also show compiler error, panic and runtime error through a clean page (see the demo below).
Demo
Watch at Youtube
Install
go get github.com/shaoshing/tower
Usage
cd your/project
tower # now visit localhost:8000
Tower will, by default, assume your web app's main file is main.go and the port is 5000. These can be changed by:
tower -m app.go -p 3000
Or put them in a config file:
tower init
vim .tower.yml
tower
Troubleshooting
'Too many open files'
Run the following command to increase the number of files that a process can open:
ulimit -S -n 2048 # OSX
How it works?
browser: http://localhost:8000
\/
tower (listening 8000)
\/ (reverse proxy)
your web app (listening 5000)
Any request comes from localhost:8000 will be handled by Tower and then be redirected to your app. The redirection is done by using httputil.ReverseProxy. Before redirecting the request, Tower will compile and run your app in another process if your app hasn't been run or file has been changed; Tower is using howeyc/fsnotify to monitor file changes.
License
Tower is released under the MIT License.
