Open xyproto opened 10 years ago
Hi @xyproto ! I think you may have overlooked a couple things with your code.
Here's how you have to go about using *web.Context, which in your case didn't have value because you didn't use it! :)
See example below:
func svgGenerator(ctx *web.Context){
page := svgPage()
ctx.WriteString(page.String())
}
func defaultHandler(ctx *web.Context){
ctx.WriteString("TODO: Implement me!")
}
func main() {
fmt.Println("BrowserSpeak Version:", browserspeak.Version)
m := martini.Classic()
m.Use(web.ContextWithCookieSecret(""))
// Connect /test.svg with svgGenerator
m.Get("/test", svgGenerator)
//TODO: implement a root handler
m.Get("/", defaultHandler)
m.Run()
}
Also, make sure to implement a root handler! It doesn't know how to handle / on its own...
Hope this helps!
Thank you! I will look into this.
cannot get req.URL.Query() 's any value from ctx.Params ? I mean martini.Params.
Hi,
The "martini" branch in one of my repositories has an example application that panics when visited, that did not panic with hoisie/web:
https://github.com/xyproto/browserspeak/tree/martini
One way of trying it out
Visiting http://localhost:8080/test.svg works, but http://localhost:8080/ gives the following backtrace:
I can not see any references to my own code, so I'm having a hard time pinpointing where this error lies. Any help is appreciated.
Best regards, Alexander Rødseth @gissues:{"order":50,"status":"done"}