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

21 lines
524 B
Go

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"))
}