//LoadController Middleware of the controller func (l *UserController) LoadController(r *mux.Router, db dbm.DatabaseQuerier, userManager user.Manager) { l.db = db l.userManager = userManager sub := r.PathPrefix(l.BasePath()).Subrouter() sub.Handle("/login", middlewares.NewMiddlewaresFunc(l.Login)).Methods("POST") sub.Handle("/logout", middlewares.NewMiddlewaresFunc(l.Logout)).Methods("GET") sub.Handle("/", middlewares.NewMiddlewaresFunc(l.Register)).Methods("POST") }
//LoadController Middleware of the controller func (m *MediaController) LoadController(r *mux.Router, db dbm.DatabaseQuerier) { m.db = db sub := r.PathPrefix(m.BasePath()).Subrouter() sub.Handle("/updateDB", middlewares.NewMiddlewaresFunc(m.CreatesMediasFromDirectory)).Methods("GET") sub.Handle("/random", middlewares.NewMiddlewaresFunc(m.GetRandomMedia)).Methods("GET") sub.Handle("/{page}", middlewares.NewMiddlewaresFunc(m.GetMedias)).Methods("GET") sub.Handle("/", middlewares.NewMiddlewaresFunc(m.UploadPrivateImage)).Methods("POST") sub.Handle("/", middlewares.NewMiddlewaresFunc(m.GetMedias)).Methods("GET") }