server.go:16:2: undefined: AddApproutes
server.go
plan primary.
import (.
" log".
" net/http".
" github.com/gorilla/mux".
).
func primary() {
log.Println(" Web server will certainly begin at http://localhost:8000/").
course:= mux.NewRouter().
AddApproutes( course).
log.Fatal( http.ListenAndServe(":8000", course)).
}
routes.go
plan primary.
import (.
" log".
" github.com/gorilla/mux".
).
func AddApproutes( course * mux.Router) {
log.Println(" Loadeding Routes ...").
route.HandleFunc(" https://forum.golangbridge.org/", RenderHome).
route.HandleFunc("/ sendEmail", SendEmailHandler). Techniques(" ARTICLE").
log.Println(" Paths are Packed.").
}
Due To The Fact That there is no AddApproutes
specified in server.go
The primary
plan is unique, it does not instantly sign up with all data in the very same folder. You require to develop one more plan, relocation that operate there, import it from server.go
As they remain in the very same plan you just require to define the routes.go documents in your run or construct command linel, state go run main.go routes.go