* feat(server): moved an http server object into a pkg subdir to be reusable for http, spots, and integrations * feat(web): isolated web module (server, router, middleware, utils) used in spots and new integrations * feat(web): removed possible panic * feat(web): split all handlers from http service into different packages for better management. * feat(web): changed router's method signature * feat(web): added missing handlers interface * feat(web): added health middleware to remove unnecessary checks * feat(web): customizable middleware set for web servers * feat(web): simplified the handler's structure * feat(web): created an unified server.Run method for all web services (http, spot, integrations) * feat(web): fixed a json size limit issue * feat(web): removed Keys and PG connection from router * feat(web): simplified integration's main file * feat(web): simplified spot's main file * feat(web): simplified http's main file (builder) * feat(web): refactored audit trail functionality * feat(web): added ee version of audit trail * feat(web): added ee version of conditions module * feat(web): moved ee version of some web session structs * feat(web): new format of web metrics * feat(web): added new web metrics to all handlers * feat(web): added justExpired feature to web ingest handler * feat(web): added small integrations improvements
34 lines
894 B
Go
34 lines
894 B
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"openreplay/backend/pkg/conditions"
|
|
"openreplay/backend/pkg/logger"
|
|
"openreplay/backend/pkg/server/api"
|
|
"openreplay/backend/pkg/token"
|
|
)
|
|
|
|
type handlersImpl struct {
|
|
log logger.Logger
|
|
responser *api.Responser
|
|
}
|
|
|
|
func NewHandlers(log logger.Logger, responser *api.Responser, tokenizer *token.Tokenizer, conditions conditions.Conditions) (api.Handlers, error) {
|
|
return &handlersImpl{
|
|
log: log,
|
|
responser: responser,
|
|
}, nil
|
|
}
|
|
|
|
func (e *handlersImpl) GetAll() []*api.Description {
|
|
return []*api.Description{
|
|
{"/v1/web/conditions/{project}", e.getConditions, "GET"},
|
|
{"/v1/mobile/conditions/{project}", e.getConditions, "GET"},
|
|
}
|
|
}
|
|
|
|
func (e *handlersImpl) getConditions(w http.ResponseWriter, r *http.Request) {
|
|
e.responser.ResponseWithError(e.log, r.Context(), w, http.StatusNotImplemented, nil, time.Now(), r.URL.Path, 0)
|
|
}
|