fix: move limiter after display views

This commit is contained in:
Urko. 2023-12-26 12:04:49 +01:00
parent bc29b63114
commit 5e62d31124
1 changed files with 5 additions and 6 deletions

View File

@ -58,12 +58,6 @@ func (s *RestServer) Start(ctx context.Context, apiPort, views string) error {
BodyLimit: MAX_FILE_SIZE_MiB,
})
s.app.Use(limiter.New(limiter.Config{
Max: 5,
Expiration: 30 * time.Minute,
LimiterMiddleware: limiter.SlidingWindow{},
}))
s.app.Use(cors.New(cors.Config{
AllowMethods: "GET,POST,OPTIONS",
AllowOrigins: "*",
@ -79,6 +73,11 @@ func (s *RestServer) Start(ctx context.Context, apiPort, views string) error {
go s.btcService.Notify(ctx, notifChan)
go s.onNotification(ctx, notifChan)
s.app.Use(limiter.New(limiter.Config{
Max: 5,
Expiration: 30 * time.Minute,
LimiterMiddleware: limiter.SlidingWindow{},
}))
s.app.Post("/order", orderHandler.Post)
if err := s.app.Listen(":" + apiPort); err != nil {