forked from ebhomengo/niki
1
0
Fork 0
niki/delivery/http/init.go

21 lines
524 B
Go
Raw Normal View History

2023-12-16 06:09:50 +00:00
package http
import (
"git.gocasts.ir/ebhomengo/niki/delivery/http/V1"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func Init() {
//initialise new Echo (web framework)
e := echo.New()
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: []string{"*" /*, "https://labstack.net"*/},
AllowHeaders: []string{echo.HeaderOrigin, echo.HeaderContentType, echo.HeaderAccept},
}))
//handle incoming requests:
V1.Init(e)
//serve with port
e.Logger.Fatal(e.Start(":1313"))
}