ant0ine / go-json-rest

A quick and easy way to setup a RESTful JSON API
https://ant0ine.github.io/go-json-rest/
MIT License
3.51k stars 382 forks source link

Using httprouter with go-json-rest #172

Open MrXu opened 8 years ago

MrXu commented 8 years ago

Instead of using the default router, is it possible to use the httprouter with go-json-rest?

ant0ine commented 8 years ago

Yes, on top of go-json-rest stack of middlewares must be an App. Which does not have to be the default router. Anything satisfying the App interface will do. It should be possible to take any third party router, and wrap it into an App.

The App interface is defined like this:

type App interface {
    AppFunc() HandlerFunc
}
malzola commented 8 years ago

I'm trying to do the opposite. In order to use manyminds/api2go with go-json-rest, I'm trying to write a api2go adapter. I need to get a http.Handler from go-json-rest and I am quite lost.