从邮递员检查时出现404页面未找到错误

I'm running the below code using goapp serve. Somehow getting 404 page not found error while checking from postman. Could you please help me to fix this

    package hello

        import (
        "fmt"
        "net/http"

        "github.com/julienschmidt/httprouter"
    )

    func Index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
        fmt.Fprint(w, "Welcome!
")
    }

    func Hello(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
        fmt.Fprintf(w, "hello, %s!
", ps.ByName("name"))
    }

    func init() {
        router := httprouter.New()
        router.GET("/", Index)
        router.GET("/hello/:name", Hello)
//log.Fatal(http.ListenAndServe(":8080", router))

    }

In postman passing endpoint http://localhost:8080/hello/hyderabad

To expand on my comment above: A handler function (or the router from julienschmidt/httprouter) does not register itself. Instead, it needs to be registered with the http server.

The simplest way to do that is usually do register with the default ServeMux using: http.Handle("/", router)

Thus, changing the init function to the following will work:

   func init() {
        router := httprouter.New()
        router.GET("/", Index)
        router.GET("/hello/:name", Hello)
        http.Handle("/", router)
    }