I'm working on a development branch for my server. The idea is to use two clones of the same git branch in two different folders, which more or less are identical. The first folder will be live, the second will be my developer.
At the moment, I'm launching the live-branch go project and later launching the developer-branch go project. Then, the entire site gets mirrored on "www.k.com/" and "www.k.com/developer/".
The problem is, this doesn't work. When I launch my second go application, everything runs fine but the last line "http.ListenAndServe" doesn't catch. There's no error that I know of that gets thrown by Listen and Serve either. This leaves my server functional but the developer/ pages throw 404's, which means the second scipt isn't doing anything. This happens to whichever I run second, meaning if I run developer then live the developer section works and the normal site doesn't.
prefix := "/"
if(utilities.Dev()){
prefix = "/developer"
}
router := mux.NewRouter()
subrouter := router.PathPrefix(prefix).Subrouter()
subrouter.HandleFunc("/",controllers.HomeHandler).Methods("GET")
subrouter.HandleFunc("/",controllers.HomeSessionHandler).Methods("POST")
subrouter.HandleFunc("/team", controllers.TeamHandler).Methods("GET")
subrouter.HandleFunc("/contact", controllers.ContactHandler).Methods("GET")
http.Handle("/", router)
http.ListenAndServe(":80", nil)
So how can I use ListenAndServe in two different processes to combine routes from two projects? Surely there must be a way, and if not, how else would I go about creating a development environment like this?