2022-05-11 15:57:56 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"cic-dw/internal/dashboard"
|
2022-05-14 10:15:45 +02:00
|
|
|
"cic-dw/internal/public"
|
2022-05-19 08:52:34 +02:00
|
|
|
|
2022-05-11 15:57:56 +02:00
|
|
|
"github.com/labstack/echo/v4"
|
2022-05-12 11:32:33 +02:00
|
|
|
"github.com/labstack/echo/v4/middleware"
|
2022-05-11 15:57:56 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func initHTTPServer() *echo.Echo {
|
|
|
|
server := echo.New()
|
|
|
|
server.HideBanner = true
|
|
|
|
// TODO: Remove after stable release
|
|
|
|
server.Debug = true
|
2022-05-12 11:32:33 +02:00
|
|
|
server.Use(middleware.CORSWithConfig(middleware.CORSConfig{
|
|
|
|
AllowOrigins: conf.Server.Cors,
|
|
|
|
AllowCredentials: true,
|
|
|
|
MaxAge: 600,
|
|
|
|
}))
|
2022-05-11 15:57:56 +02:00
|
|
|
|
|
|
|
dashboard.InitDashboardApi(server, db, preparedQueries.dashboard)
|
2022-05-19 08:52:34 +02:00
|
|
|
public.InitPublicApi(server, db, batchBalance, preparedQueries.public)
|
2022-05-11 15:57:56 +02:00
|
|
|
|
|
|
|
return server
|
|
|
|
}
|