VoltBoy
VoltBoy

Reputation: 11

How to initialize variable inside HandleFunc in gorilla/mux package

I had a handlerfunc:

    r.HandleFunc("/getstatus_a/{price}", getStatusWithPrice).Methods("GET")

price is int variable, I need to initialize it inside path. How can I do that?

P.S. In getStatusWithPrice() price used as an argument that transmit in sql request.

Upvotes: 0

Views: 73

Answers (1)

VoltBoy
VoltBoy

Reputation: 11

Problem solved

    vars := mux.Vars(r)
    price := vars["price"]

Upvotes: 1

Related Questions