Questions tagged [mux]

Package gorilla/mux implements a request router and dispatcher for matching incoming requests to their respective handler.

331 questions
-2
votes
1 answer

Routing in Golang using only stdlib

Recently i started one school project, i need to make a web forum using only standard Go library. And the main obstacle i have is i don't know how to properly make routing. For example: router.HandleFunc("/threads",…
a b
  • 947
  • 1
  • 6
  • 7
-2
votes
1 answer

how to post body raw using mux and gorm in golang?

I have problem with method post using gorilla/mux, and gorm, I want to request in body raw, but my code is error when I EXEC my procedure, why my code error? I'm still not understand to using request in body using gorilla/mux and gorm, how make post…
dera ta
  • 63
  • 1
  • 2
  • 10
-2
votes
1 answer

How do i write golang middleware which handle response/error from API?

Basically, I want to write one middleware which closes transaction object is created while a request. I am using gorilla mux package. I am familiar with python-Django middlewares and it gives proper handling of error or response. but not able to…
Niel_patel
  • 74
  • 8
-2
votes
2 answers

cannot find package "github.com/gorrila/mux" in any of

The error message is: app.go:9:3: cannot find package "github.com/gorrila/mux" in any of: /usr/local/Cellar/go/1.10.3/libexec/src/github.com/gorrila/mux (from $GOROOT) /Users/myname/go/src/github.com/gorrila/mux (from $GOPATH) I understand…
user9503053
  • 107
  • 3
  • 15
-2
votes
1 answer

How to list all variables in Gorilla Mux?

When you create a funcHandler in Golang and use Gorilla Mux, I know that you can access a specific input variable by calling Mux.Vars. However, I'm not sure how that works when you have data stored in JSON format, and part of that is because I'm not…
user65271
  • 13
  • 2
-2
votes
1 answer

Add SDT PSI/SI information in a TS file

Is there any software that can add SDT information on a already muxed ts file ? I can remux the mpeg file to TS again but I just can't find anything that guides me on how to add the sdt tables, all I can find are the DVB analyser and they cannot add…
-2
votes
1 answer

go > how to refactor http handler from main

I'm learning go language and I still have some lack of knowledge. I'm writing http static server (in 1st phase to serve assets). Also I'm trying to use gorilla/mux package as router. So far I ended up with pagekage main import ( "fmt" …
Jaro
  • 3,799
  • 5
  • 31
  • 47
-3
votes
2 answers

Error while converting json to struct from Go

func MakeMap(w http.ResponseWriter, r *http.Request) { // userInfo := context.Get(r, "userInfo").(model.User) type _getData struct { Title string `json:"title"` Tag []string `json:"tag"` } var getData _getData …
Choi yun seok
  • 309
  • 2
  • 15
-3
votes
1 answer

In HTTP response for a chunked data how to set Content-Length

We have written a service which sends some encoded data as chunked to a proxy service which need Content-Length header to be set so that it can send proper response to end point. Even if I set the Content-Length header still it get stripped as part…
Abhinav
  • 975
  • 4
  • 18
  • 35
-3
votes
2 answers

How to access another file in GO

I'm trying to access a controller from main.go but I'm getting the following error: ./main.go:34:28: cannot refer to unexported name controllers.getUserDetails ./main.go:34:28: undefined: controllers.getUserDetails here's a snippet of my main.go,…
Atishay Jain
  • 1,425
  • 12
  • 22
-3
votes
1 answer

GoLang, bad readout from slice

Im pretty new in GoLang and i need some help. Im making simple API app. pasing structs by API to slice looks like this: type Struct struct { //some records } var structs []Struct //slice func SetStruct(w http.ResponseWriter, req…
user9626387
-3
votes
2 answers

Object containing a map?

I'm trying to get a list of all of our endpoints. We use Goa. I noticed that we add all of our endpoints to a service (goa.New("service_name")). I also realized that if I print service.Mux I can see all the endpoints. However, the endpoints look…
BigBug
  • 6,202
  • 23
  • 87
  • 138
-3
votes
1 answer

Understanding mux router in golang

here is my code trying to display a base64 image it worked before using mux. I've used http handlefunc before using mux, here i want to use mux and get the value of key. package main import ( "fmt" "net/http" "strconv" base64…
Bussiere
  • 500
  • 13
  • 60
  • 119
-3
votes
1 answer

How to call/open a URL within Go method?

I have a Gorilla Mux router set up in Go. I have routes set up within that router, as well as function handlers associated with those routes. The router works perfectly, if you open a browser window and enter specific URLs. However, the problem I'm…
AbhishekSaha
  • 705
  • 3
  • 9
  • 24
-4
votes
1 answer

Go Mux Middlware not using my CORS handler

mx := mux.NewRouter() mx.Use(CorsHandler) sch := mx.NewRoute().Subrouter() sch.Use(middleware.ValidateSchoolToken) teacher := mx.NewRoute().Subrouter() teacher.Use(middleware.ValidateToken) CorsHandler is not used when the code runs
nator
  • 1
1 2 3
22
23