func main() {
beego.Router("/", &MainController{})
beego.Router("/userid/", &SqlController{})
beego.Run()
}
this works fine for url "http://localhost:8080/userid" but if i want user id value to be dynamic for ex "http://localhost:8080?userid=1" i could not how o achieve this using router in go.
Extracting xxx
from ?id=xxx
is about request parameter parsing, you can get examples in beego's document.
Routing (in your context) is about mapping requests matching a certain pattern to corresponding actions. When id is different, I suppose what you want is not getting them mapped to different actions. So it shouldn't be called routing. It's just parameter parsing.