我无法让golang识别带有参数的get请求

I am trying to get create a simple axios get request with parameters in React to work with Go. No matter what I do, keep getting the GET URL path not found (404) error. Here is the JS

import React, {Component} from 'react'
import axios from "axios"

class ShowLoc extends Component {
    constructor(props){
        super(props)
    }

    componentDidMount(){
        const {id} = this.props.match.params
        axios.get(`/loc/${id}`)
    }

    render() {
        return(
            <div>
                Specific Location
            </div>
        )
    }
}

export default ShowLoc

And here are the relevant parts of my server.go file. I am using gorilla/mux to recognize the parameters

func main() {

    fs := http.FileServer(http.Dir("static"))
    http.Handle("/", fs)

    bs := http.FileServer(http.Dir("public"))
    http.Handle("/public/", http.StripPrefix("/public/", bs))

    http.HandleFunc("/show", show)
    http.HandleFunc("/db", getDB)

    r := mux.NewRouter()
    r.HandleFunc("/loc/{id}", getLoc)

    log.Println("Listening 3000")
    if err := http.ListenAndServe(":3000", nil); err != nil {
        panic(err)
    }
}

func getLoc(w http.ResponseWriter, r *http.Request) {
    if r.Method != "GET" {
        http.Error(w, http.StatusText(405), http.StatusMethodNotAllowed)
        return
    }
    id := r
    fmt.Println("URL")
    fmt.Println(id)
}

I never hit my getLoc function since my get request is not found. What should I do get the params from my get request?

You haven't used your mux router. Since you passed in nil to ListenAndServe, it's using the default router, which has all of your other handlers attached. Instead, register all your handlers with your mux router and then pass it as the second argument to ListenAndServe.

func main() {
    r := mux.NewRouter()

    fs := http.FileServer(http.Dir("static"))
    r.Handle("/", fs)

    bs := http.FileServer(http.Dir("public"))
    r.Handle("/public/", http.StripPrefix("/public/", bs))

    r.HandleFunc("/show", show)
    r.HandleFunc("/db", getDB)

    r.HandleFunc("/loc/{id}", getLoc)

    log.Println("Listening 3000")
    if err := http.ListenAndServe(":3000", r); err != nil {
        panic(err)
    }
}

func getLoc(w http.ResponseWriter, r *http.Request) {
    if r.Method != "GET" {
        http.Error(w, http.StatusText(405), http.StatusMethodNotAllowed)
        return
    }

    id := r
    fmt.Println("URL")
    fmt.Println(id)
}