boilerplate-go/main.go

32 lines
841 B
Go

package main
import (
"gitlab.com/arkadooti.sarkar/go-boilerplate/core/appcontext"
"gitlab.com/arkadooti.sarkar/go-boilerplate/core/log"
"gitlab.com/arkadooti.sarkar/go-boilerplate/core/mongomanager"
"gitlab.com/arkadooti.sarkar/go-boilerplate/db/mongo"
"gitlab.com/arkadooti.sarkar/go-boilerplate/domain/standard"
"gitlab.com/arkadooti.sarkar/go-boilerplate/webService"
"os"
)
const servicePort = "4100"
const serviceRoute = "/boilerplate"
func main() {
ctx := appcontext.New()
mongoClient, err := mongomanager.NewMongoClient(os.Getenv("MongoHost"), "myapp")
if err != nil {
log.GenericError(ctx, err)
}
mongoService := mongo.NewMongoService(mongoClient)
domain := standard.NewDomainService(mongoService)
newService := webService.NewWebService(domain, mongoService, serviceRoute, servicePort)
newService.Run(ctx)
}