lot of new functionalities
This commit is contained in:
37
servers/web/api/handler.go
Normal file
37
servers/web/api/handler.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"git.coopgo.io/coopgo-apps/parcoursmob/core/application"
|
||||
"git.coopgo.io/coopgo-apps/parcoursmob/core/utils/cache"
|
||||
"git.coopgo.io/coopgo-apps/parcoursmob/core/utils/geo"
|
||||
"git.coopgo.io/coopgo-apps/parcoursmob/core/utils/identification"
|
||||
cacheStorage "git.coopgo.io/coopgo-apps/parcoursmob/core/utils/storage"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
type Handler struct {
|
||||
config *viper.Viper
|
||||
idp *identification.IdentificationProvider
|
||||
applicationHandler *application.ApplicationHandler
|
||||
cacheService *cache.CacheService
|
||||
geoService *geo.GeoService
|
||||
}
|
||||
|
||||
func NewHandler(cfg *viper.Viper, idp *identification.IdentificationProvider, appHandler *application.ApplicationHandler, cacheHandler cacheStorage.CacheHandler) *Handler {
|
||||
cacheService := cache.NewCacheService(cacheHandler)
|
||||
geoService := geo.NewGeoService(cfg.GetString("geo.pelias.url"))
|
||||
|
||||
return &Handler{
|
||||
config: cfg,
|
||||
idp: idp,
|
||||
applicationHandler: appHandler,
|
||||
cacheService: cacheService,
|
||||
geoService: geoService,
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Handler) NotFound(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}
|
||||
Reference in New Issue
Block a user