ServeMux.NewServeMux
Overview
NewServeMux returns an empty task router.
Part of the queue package — Node.js analog: bull.
Method on ServeMux — call it on a value of that type after constructing or receiving one from a constructor.
Signature
go
func NewServeMux() *ServeMuxCompare: Node.js · Standard Go · gox
js
// Typical bull pattern in Node.jsgo
// hibiken/asynq client + workergo
import "github.com/sahilkhaire/gox/queue"
mux := queue.NewServeMux()Example
go
import "github.com/sahilkhaire/gox/queue"
mux := queue.NewServeMux()Tips
Obtain a ServeMux value first (see constructors on the package overview), then call NewServeMux.
Standard library alternative
gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.