2022-05-11 15:57:56 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2022-05-30 16:24:59 +02:00
|
|
|
"cic-dw/internal/admin"
|
2022-05-11 15:57:56 +02:00
|
|
|
"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-23 14:41:24 +02:00
|
|
|
public.InitPublicApi(server, db, batchBalance, cicnetClient, preparedQueries.public)
|
2022-05-31 10:35:49 +02:00
|
|
|
admin.InitAdminApi(server, db, preparedQueries.admin, metaClient, conf.Jwt.Secret)
|
2022-05-11 15:57:56 +02:00
|
|
|
|
|
|
|
return server
|
|
|
|
}
|