MCPcopy Create free account
hub / github.com/devfeel/dotweb / New

Function New

dotweb.go:96–120  ·  view source on GitHub ↗

New create and return DotApp instance default run mode is RunMode_Production

()

Source from the content-addressed store, hash-verified

94// New create and return DotApp instance
95// default run mode is RunMode_Production
96func New() *DotWeb {
97 app := &DotWeb{
98 HttpServer: NewHttpServer(),
99 Middlewares: make([]Middleware, 0),
100 Items: core.NewConcurrenceMap(),
101 Config: config.NewConfig(),
102 middlewareMap: make(map[string]MiddlewareFunc),
103 middlewareMutex: new(sync.RWMutex),
104 pluginMap: make(map[string]Plugin),
105 pluginMutex: new(sync.RWMutex),
106 StartMode: StartMode_New,
107 serverStateInfo: core.NewServerStateInfo(),
108 }
109 // set default run mode = RunMode_Production
110 app.Config.App.RunMode = RunMode_Production
111 app.HttpServer.setDotApp(app)
112 // add default httphandler with middlewares
113 // fixed for issue #100
114 app.Use(&xMiddleware{})
115
116 // init logger
117 app.appLog = logger.NewAppLog()
118
119 return app
120}
121
122// Classic create and return DotApp instance\
123// if set logPath = "", it will use bin-root/logs for log-root

Callers 15

mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
TestSesionConfigFunction · 0.85

Calls 7

UseMethod · 0.95
NewConcurrenceMapFunction · 0.92
NewConfigFunction · 0.92
NewServerStateInfoFunction · 0.92
NewAppLogFunction · 0.92
NewHttpServerFunction · 0.85
setDotAppMethod · 0.80

Tested by 15

TestSesionConfigFunction · 0.68
initContextFunction · 0.68
initAllContextFunction · 0.68
TestBinder_Bind_jsonFunction · 0.68
TestBinder_Bind_xmlFunction · 0.68
TestBinder_Bind_defaultFunction · 0.68
Test_RunMode_1Function · 0.68
Test_RunMode_2Function · 0.68