Brijesh's Git Server — watchman @ main

observability tool, needs to be rewritten once identity is stable

middleware/apply.go (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
package middleware

import (
	"net/http"
	"watchman/utils"
)

func ApplyMiddleware(handler http.Handler) http.Handler {
	config := utils.ReadConfig()

	httpHandlerWithMiddleware := CorsMiddleware(
		RequestIDMiddleware(
			Ratelimit(
				config, handler,
			),
		),
	)

	return httpHandlerWithMiddleware
}