fix: more refactoring #181
Some checks failed
Build Docker Image / Build-Docker-Image (push) Failing after 2m8s
Some checks failed
Build Docker Image / Build-Docker-Image (push) Failing after 2m8s
This commit is contained in:
@@ -13,15 +13,17 @@ import (
|
||||
func GetHandler(d *sql.DB, serverSettings *types.ServerSettings) http.Handler {
|
||||
var router = http.NewServeMux()
|
||||
|
||||
router.HandleFunc("/", service.HandleIndexAnd404(d, serverSettings))
|
||||
|
||||
randomGenerator := service.NewRandomGeneratorImpl()
|
||||
clock := service.NewClockImpl()
|
||||
dbAuth := db.NewDbAuthSqlite(d)
|
||||
mailService := service.NewMailServiceImpl(serverSettings)
|
||||
serviceAuth := service.NewServiceAuthImpl(dbAuth, randomGenerator, clock, mailService, serverSettings)
|
||||
|
||||
handlerIndex := NewHandlerIndex(d, serviceAuth, serverSettings)
|
||||
handlerAuth := NewHandlerAuth(d, serviceAuth, serverSettings)
|
||||
|
||||
handlerIndex.handle(router)
|
||||
|
||||
// Serve static files (CSS, JS and images)
|
||||
router.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
|
||||
|
||||
@@ -31,7 +33,3 @@ func GetHandler(d *sql.DB, serverSettings *types.ServerSettings) http.Handler {
|
||||
|
||||
return middleware.Logging(middleware.EnableCors(serverSettings, router))
|
||||
}
|
||||
|
||||
func authMiddleware(db *sql.DB, h http.Handler) http.Handler {
|
||||
return middleware.EnsureValidSession(db, h)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user