func NewAppServer(mode RunMode, config *AppConfig, logger *AppLogger) *AppServer { server := &AppServer{ mode: mode, config: config, logger: logger, requestId: DefaultHttpRequestId, } // init Route server.AppRoute = NewAppRoute("/", server) // init router server.router = httprouter.New() server.router.HandleMethodNotAllowed = false // strict for RESTful // overwrite server.pool.New = func() interface{} { return NewContext(server) } return server }
func NewAppServer(mode RunMode, config *AppConfig, logger Logger) *AppServer { server := &AppServer{ mode: mode, config: config, logger: logger, requestId: DefaultHttpRequestId, } // init Route server.AppRoute = NewAppRoute("/", server) // init default handler with httprouter.Router handler := httprouter.New() handler.RedirectTrailingSlash = false handler.HandleMethodNotAllowed = false // strict for RESTful server.handler = handler // overwrite server.pool.New = func() interface{} { return NewContext(server) } return server }