forked from ebhomengo/niki
21 lines
524 B
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"))
|
|
}
|