Package gorilla/mux implements a request router and dispatcher for matching incoming requests to their respective handler.
Questions tagged [mux]
331 questions
4
votes
1 answer
Reducing boilerplate in a mux middlware and custom context implementation
I'm fairly new to Go and trying to create a middleware implementation in a gateway library that I'm building on top of mux. So far, I've come up up with this:
type (
MyContext struct {
// ...
}
APIGateway struct {
mux…

Jay
- 1,089
- 12
- 29
4
votes
1 answer
How to pass a parameter to a MiddlewareFunc?
I'm working on a small demo that tries to explain how a basic HTTP handler works, and I found the following example:
package main
func router() *mux.Router {
router := mux.NewRouter()
auth := router.PathPrefix("/auth").Subrouter()
…

Cas1337
- 141
- 15
4
votes
3 answers
Unable to read variables from a url using gorilla mux in golang
I am trying to write a unit test using gotests and gomock to my restful service written in golang using gorilla but service fails to get variables from the url
Here is my request
req, err := http.NewRequest("GET",…

DoIt
- 3,270
- 9
- 51
- 103
4
votes
2 answers
Serve static html files with gorilla mux
I'm trying to serve different HTML files depending on the route. The router works fine for "/" and it serves the index.html. However when going to any other route like "/download", it also renders the index.html, even tho the file that is to be…

Sander Hellesø
- 271
- 6
- 16
4
votes
1 answer
Muxing AAC audio and h.264 video streams to mp4 with AVFoundation
For OSX and IOS, I have streams of real time encoded video (h.264) and audio (AAC) data coming in, and I want to be able to mux these together into an mp4.
I'm using an AVAssetWriterto perform the muxing.
I have video working, but my audio still…

Sully
- 41
- 2
4
votes
2 answers
Gorilla Mux Use() Function Not Working
I want to use the Use() function of the Gorilla Mux package, but I cannot get it to work. It says: r.Use undefined (type *mux.Router has no field or method Use). I used almot the identitcal example from the documentation. My code looks like…

stef
- 313
- 2
- 12
4
votes
0 answers
Issue while Setting PID's to MPEGTS Mux
I am streaming a .ts file over UDP, by setting PID's for each stream.
This ts file contains, video and text streams.
I would like to set my own pid's to mpegtsmux as follows,
g_object_set (mMux, "prog-map", gst_structure_from_string…

Prasanth Kumar Arisetti
- 697
- 2
- 10
- 33
4
votes
2 answers
Gorilla Mux Regex
I'm using the Mux package from the Golang Gorilla Toolkit for my routes.
Consider the following routes:
m.HandleFunc("/admin/install", installHandler).Methods("GET")
m.HandleFunc("/admin/^((?!install).)*$",…

Dac0d3r
- 2,176
- 6
- 40
- 76
4
votes
1 answer
How to call a route by its name from inside a handler?
How do I properly refer to route names from inside handlers?
Should mux.NewRouter() be assigned globally instead of standing inside a function?
func AnotherHandler(writer http.ResponseWriter, req *http.Request) {
url, _ := r.Get("home") // I…

Pierre Prinetti
- 9,092
- 6
- 33
- 49
4
votes
1 answer
muxing jpeg to mkv using gstreamer
Situation:
When I'm trying to mux jpegs to mkv file I'll get a zero sized file. I must put encode and decode elements between parser and muxer for correct output. When I'm muxing a h264 video with same code I'll get correct video file, that means…

slayer69
- 81
- 10
4
votes
1 answer
GStreamer Tee (Multiple Multiplexer)
I'm trying to store a video stream (coming from my webcam) into a MKV and FLV file. This means I have to split the video and audio pipeline after the h264 Encoding and mux each path with a different muxer.
This is how I imagine it should be…

Dominik Schreiber
- 769
- 2
- 15
- 25
3
votes
1 answer
GOLANG How can I load a certain html file from templates directory using http.FileServer
func main() {
mux := http.NewServeMux()
staticHandler := http.FileServer(http.Dir("./templates"))
mux.Handle("/", http.StripPrefix("/", staticHandler))
log.Fatal(http.ListenAndServe(":8080", mux))
}
I want to load a html file which…

부건혁
- 91
- 7
3
votes
2 answers
Creating a custom error in golang for http responses
i wanted to create custom errors for my authentication service that i am currently working on.
Since i have to create a error for every http responses, and i am fairly new to golang i am facing difficulties.
The below code is the replica of the…

Aditya vatsa
- 31
- 1
- 2
3
votes
0 answers
How to serve static file to dynamic path in Go?
My file structure is so main.go is inside folder co and inside folder cmd.
-assets/
-cmd/co/main.go
Here is my code in main.go,
func main() {
router := NewRouter()
router.HandleFunc("/search", api.SearchHandler)
…

ardianbsyla
- 73
- 6
3
votes
5 answers
Flutter/Dart SocketException Uploading Video File to URL
I am recieving this error message when attempting to upload a video file to the speicified URL:
DioError (DioError [DioErrorType.DEFAULT]: SocketException: OS Error: Connection reset by peer, errno = 54, address = storage.googleapis.com, port =…

Josh Kahane
- 16,765
- 45
- 140
- 253