Пример #1
0
func main() {
	fmt.Println("Initializting Main")
	InitiateRedis()
	gorest.RegisterService(new(HandlingAlgo))
	http.Handle("/", gorest.Handle())
	addr := fmt.Sprintf(":%s", port)
	http.ListenAndServe(addr, nil)
}
Пример #2
0
func main() {

	//fmt.Println("Hello World!")
	LoadConfiguration()

	if cacheMachenism == "memory" {

		ReloadAllMetaData()
	}

	InitiateRedis()
	InitiateStatDClient()
	go ClearData()

	//jwtMiddleware := loadJwtMiddleware()

	gorest.RegisterService(new(DashBoardEvent))
	//gorest.RegisterService(new(DashBoardGraph))

	//app := jwtMiddleware.Handler(gorest.Handle())

	c := cors.New(cors.Options{
		AllowedHeaders: []string{"accept", "authorization"},
	})
	handler := c.Handler(gorest.Handle())
	addr := fmt.Sprintf(":%s", port)
	s := &http.Server{
		Addr:           addr,
		Handler:        handler,
		ReadTimeout:    10 * time.Second,
		WriteTimeout:   10 * time.Second,
		MaxHeaderBytes: 1 << 20,
	}

	s.SetKeepAlivesEnabled(false)
	s.ListenAndServe()

	//http.ListenAndServe(addr, handler)

	////fmt.Scanln()
	//client, error := goredis.Dial(&goredis.DialConfig{Address: "127.0.0.1:6379"})
	//if error == nil {
	//client.Set("key", "value", 0, 0, false, false)

	//	go OnEvent("3", "1", "CALLSERVER", "CALL", "IVR", "1111111", client)

	//} else {
	//	fmt.Println(error.Error())
	//}
	//fmt.Println("Hello World!")
}
Пример #3
0
func InitiateService() {
	gorest.RegisterService(new(CallbackServerSelfHost))
	http.Handle("/", gorest.Handle())
	addr := fmt.Sprintf(":%s", port)
	http.ListenAndServe(addr, nil)
}
Пример #4
0
func InitiateService() {
	listeningPort := fmt.Sprintf(":%s", port)
	gorest.RegisterService(new(ArdsLiteRS))
	http.Handle("/", gorest.Handle())
	http.ListenAndServe(listeningPort, nil)
}