Exemplo n.º 1
0
func main() {
	fmt.Printf("Running at %v\n", port)

	e := echo.New()

	routes.Init(e)

	e.Run(standard.WithTLS(port, "server/cert/server.crt", "server/cert/server.key"))
}
Exemplo n.º 2
0
Arquivo: base.go Projeto: xtfly/gofd
func (s *BaseService) runEcho() error {
	net := s.Cfg.Net
	var sr *standard.Server
	if net.TLS != nil {
		sr = standard.WithTLS(fmt.Sprintf("%s:%v", net.IP, net.MgntPort),
			net.TLS.Cert,
			net.TLS.Key,
		)
	} else {
		sr = standard.New(fmt.Sprintf("%s:%v", net.IP, net.MgntPort))
	}
	sr.SetHandler(s.echo)
	sr.SetLogger(s.echo.Logger())

	log.Infof("Starting http server %s:%v", net.IP, net.MgntPort)
	if err := sr.Start(); err != nil {
		log.Infof("Start http server %s:%v failed %v", net.IP, net.MgntPort, err)
		return err
	}
	return nil
}