In the main function, I have a gorilla mux router, and a function to handle the route.
var router = mux.NewRouter()
func main() {
router.HandleFunc("/", ParseSlash)
http.Handle("/", router)
http.ListenAndServe(":8000", nil)
}
and ParseSlash looks like
const slash = `<h1>Login</h1>
<form method="post" action="/login">
<label for="name">User name</label>
<input type="text" id="name" name="name">
<label for="password">Password</label>
<input type="password" id="password" name="password">
<button type="submit">Login</button>
</form>`
func ParseSlash(response http.ResponseWriter, request *http.Request) {
fmt.Fprintf(response, slash)
}
However, in main, we are not calling the function as ParseSlash(), but ParseSlash inside router.HandleFunc(). Where do the function get the parameters from, if we are not providing explicitely? What is this way of calling a function termed as?
Thank you.