Savvoy

note

Nov 26th, 2020
938
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. func (app *App) setRouters() {
  2.     for _, route := range routes.DefinedRoutes {
  3.         var handler http.HandlerFunc = func(w http.ResponseWriter, r *http.Request) {
  4.             start := time.Now()
  5.             log.Printf(
  6.                 "%s\t%s\t%s\t%s",
  7.                 r.Method,
  8.                 r.RequestURI,
  9.                 route.Name,
  10.                 time.Since(start),
  11.             )
  12.            
  13.             route.RouteHandle(app.DB , w, r)
  14.         }
  15.        
  16.         app.Router.HandleFunc(route.Pattern, handler).
  17.             Name(route.Name).
  18.             Methods(route.Method)
  19.     }
  20. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×