I'm having an issue using Gorilla for routing. For some routes it works fine, but for other it does not.
I have the following code:
import (
"github.com/gorilla/mux"
"github.com/justinas/alice"
)
mx.Handle("/register", commonHandlers.ThenFunc(registerUser)).Methods("POST").Name("register") // This works
mx.Handle("/verify", commonHandlers.ThenFunc(verifyUser)).Methods("GET").Name("verify") // Does not work
The verifyUser calls the Verify function handler is just suppose to output something to the console, for example:
log.Println("This works!")
But for some reason, when I visit example.com/verify, the function Verify never actually gets called. Oddly enough, my AngularJS code actually outputs something when /verify is visited, but my Go code does not.
I have the following configuration in my nginx file, not sure if it may conflict with Gorilla routing.
server {
listen 80; ## listen for ipv4; this line is default and implied
root /home/usr/go/src/project/dist/;
server_name localhost;
index index.html index.htm;
location @proxy {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
#proxy_pass http://127.0.0.1:3000;
proxy_pass http://127.0.0.1:9000;
}
location / {
try_files $uri.html $uri/ @proxy;
autoindex on;
}
}
Is there something wrong with my routing?