NewServer initializes a new HTTP/2 server. Use its Run/Listen methods to start it based on network options.
(c Configuration)
| 26 | // NewServer initializes a new HTTP/2 server. |
| 27 | // Use its Run/Listen methods to start it based on network options. |
| 28 | func 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 | |
| 45 | func (srv *Server) prepare() error { |
| 46 | // Here you can register the database instance |