As shown in the concept diagram, The server engine is responsible for routing of the traffic, you can install your own mux on the GoServerEngine once it is initialized. Requests that are sent through the GoServerEngine handlerwill be processed by Revel which creates the Controller instance and passes the request to theFilter Chain.

Applications may integrate existing http.Handlers by doing the following:

  1. funcinstallHandlers(){revel.AddInitEventHandler(func(eventint,_interface{})(rint){ifevent==revel.ENGINE_STARTED{var(serveMux=http.NewServeMux()revelHandler=revel.CurrentEngine.(*revel.GoHttpServer).Server.Handler)serveMux.Handle("/",revelHandler)serveMux.Handle("/path",myHandler)revel.CurrentEngine.(*revel.GoHttpServer).Server.Handler=serveMux}return})}funcinit(){revel.OnAppStart(installHandlers)}

What is the relationship between interceptors, filters, and modules ?

  • Modules are packages that can be plugged into an application. They allowsharing of controllers, views, assets, and other code between multiple Revelapplications (or from third-party sources).

  • Filters are functions that may be hooked into the request processingpipeline. They generally apply to the application as a whole and handletechnical concerns, orthogonal to application logic.

  • Interceptors are a convenient way to package data and behavior, sinceembedding a type imports its interceptors and fields. This makes interceptorsuseful for things like verifying the login cookie and saving that informationinto a field. Interceptors can be applied to one or more controllers.

Hot Reload is really slow with sqlite3 ?

  • The github.com/mattn/go-sqlite3 package has a five megabyte .c file.
  • When building the package, this .c file is compiled and building a 5mb .c takes a while.
  • So unless you go install it. the package is built every time you build a package which depends on it.
  • See bug 290
  1. go install github.com/mattn/go-sqlite3

Is there an SMTP mailer ?

Revel previously had a mailer, but this was removed (#633)in favour of a third party flexibility/quality/DRY. See:

原文: https://revel.github.io/manual/faq.html