MCPcopy Create free account
hub / github.com/kataras/iris / NewServer

Function NewServer

_examples/project/api/server.go:28–43  ·  view source on GitHub ↗

NewServer initializes a new HTTP/2 server. Use its Run/Listen methods to start it based on network options.

(c Configuration)

Source from the content-addressed store, hash-verified

26// NewServer initializes a new HTTP/2 server.
27// Use its Run/Listen methods to start it based on network options.
28func NewServer(c Configuration) *Server {
29 app := iris.New().SetName(c.ServerName)
30 app.Configure(iris.WithConfiguration(c.Iris), iris.WithLowercaseRouting)
31
32 srv := &Server{
33 Application: app,
34 config: c,
35 }
36
37 if err := srv.prepare(); err != nil {
38 srv.Logger().Fatal(err)
39 return nil
40 }
41
42 return srv
43}
44
45func (srv *Server) prepare() error {
46 // Here you can register the database instance

Callers

nothing calls this directly

Calls 6

prepareMethod · 0.95
NewMethod · 0.80
FatalMethod · 0.80
ConfigureMethod · 0.65
LoggerMethod · 0.65
SetNameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…