Beispiel #1
0
func main() {
	flag.Parse()
	loadConfig()
	gorest.RegisterService(new(DreamService))
	var err error

	webClient, err = spicerack.LogIntoSaltyBet(illumEmail, illumPass)
	if err != nil {
		fmt.Printf("Error logging into Salty Bet: %v\n", err)
	}

	if !*fastcgi {
		fmt.Println("Running Locally")
		static := []string{"index", "search", "ds.js", "s.js", "ta.css"}
		for _, p := range static {
			http.HandleFunc(fmt.Sprintf("/%s", p), staticPage)
		}
		http.Handle("/", gorest.Handle())
		fmt.Println(http.ListenAndServe(":9000", nil))
	} else {
		fmt.Println("Running as FastCGI")
		l, _ := net.Listen("tcp", ":9000")
		fmt.Println(fcgi.Serve(l, gorest.Handle()))
	}
}
Beispiel #2
0
func main() {
	// register with gorest
	gorest.RegisterService(new(SshService))

	http.Handle("/", gorest.Handle())
	log.Fatal(http.ListenAndServe(":7654", nil))
}
Beispiel #3
0
func OrchioMain() {
	gorest.RegisterServiceOnPath(orchioRoot, new(OrchioReadService))
	gorest.RegisterServiceOnPath(orchioRoot, new(OrchioWriteService))
	registerExtendedGraphServices()
	http.Handle("/", gorest.Handle())
	http.ListenAndServe(":8787", nil)
}
Beispiel #4
0
Datei: rest.go Projekt: nhp/dsapi
func main() {
	service.Config.ConfigFrom("config.json")
	gorest.RegisterService(new(service.ProductService))
	gorest.RegisterService(new(service.BestandService))
	gorest.RegisterService(new(service.PriceService))
	http.Handle("/", gorest.Handle())
	http.ListenAndServe(":8787", nil)
}
Beispiel #5
0
func SetupRestServices() {

	deviceService := new(device.DeviceService)

	gorest.RegisterService(deviceService)
	http.Handle("/", gorest.Handle())
	http.ListenAndServe(":"+gpnsconfig.BaseConfigInstance().Port(), nil)
}
Beispiel #6
0
func main() {
	_, err := exec.LookPath("gluster")
	if err != nil {
		panic(err.Error())
	}
	gorest.RegisterService(new(GlusterService))
	http.Handle("/", gorest.Handle())
	http.ListenAndServe(":7331", nil)
}
Beispiel #7
0
func main() {
	fmt.Println("Hello!")
	listener, err := net.Listen("tcp", ":8080")
	if err != nil {
		fmt.Println("Error!")
		fmt.Println(err)
	}
	// srv := http.NewServeMux()
	// srv.HandleFunc("/", gorest.Handle())
	fcgi.Serve(listener, gorest.Handle())
}
Beispiel #8
0
func main() {
	gorest.RegisterService(new(WalkerService))
	http.Handle("/api/", gorest.Handle())
	http.Handle("/", http.FileServer(http.Dir("public")))

	// http.HandleFunc("/walkers", ListWalkers)
	err := http.ListenAndServe(":8080", nil)
	if err != nil {
		log.Printf("Error in webserver: %v", err)
	}

}
Beispiel #9
0
func main() {
	Initialize()

	//Regster REST services.
	gorest.RegisterService(new(RestController))
	http.Handle("/", gorest.Handle())

	err := http.ListenAndServe(*listen, nil)
	if err != nil {
		panic("Error starting RestController.")
	}

}
Beispiel #10
0
func threadWeb() {
	log.Info("Starting web thread")
	gorest.RegisterService(new(ApiService))
	httpServer := &http.Server{
		Addr:           fmt.Sprintf(":%d", *webPort),
		ReadTimeout:    5 * time.Second,
		WriteTimeout:   5 * time.Second,
		MaxHeaderBytes: 1 << 20,
	}
	http.Handle("/api/", gorest.Handle())
	http.Handle("/ui/", http.StripPrefix("/ui/", http.FileServer(http.Dir("web"))))
	httpServer.ListenAndServe()
}
Beispiel #11
0
func main() {
	log.Println(os.Getenv("PORT"))
	gorest.RegisterService(new(AppService))
	gorest.RegisterService(new(UserService))
	gorest.RegisterService(new(ConversationService))
	gorest.RegisterService(new(MsgService))
	gorest.RegisterService(new(AuthenticateService))
	gorest.RegisterService(new(CircleService))
	gorest.RegisterService(new(LocationService))
	http.Handle("/", gorest.Handle())
	// http.HandleFunc("/tempurl", getData)
	http.ListenAndServe(":"+os.Getenv("PORT"), nil)
	// User.GetAll()
}
Beispiel #12
0
func main() {
	address = "localhost:8787"

	gorest.RegisterService(new(UserService))
	http.Handle(serviceRoot, gorest.Handle())
	http.HandleFunc("/", index)
	http.Handle("/js/", http.FileServer(http.Dir("static")))
	http.Handle("/css/", http.FileServer(http.Dir("static")))

	// Mark file for livereload
	cmd := exec.Command("touch", "server.run")
	cmd.Run()

	http.ListenAndServe(address, nil)
}
Beispiel #13
0
func StartServing(appState *appstate.ApplicationState) {
	gorest.RegisterService(api.NewMetricsService(appState))

	exp.Handle("/", &StatusHandler{appState: appState})
	exp.HandleFunc("/graph", graphHandler)
	exp.HandleFunc("/console", consoleHandler)

	exp.Handle("/api/", gorest.Handle())
	exp.Handle("/metrics.json", registry.DefaultHandler)
	if *useLocalAssets {
		exp.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("web/static"))))
	} else {
		exp.Handle("/static/", http.StripPrefix("/static/", new(blob.Handler)))
	}

	go http.ListenAndServe(*listenAddress, exp.DefaultCoarseMux)
}
Beispiel #14
0
func main() {
	cebadapter.Attach("Registration", func(s bool) {
		cebadapter.GetLatestGlobalConfig("StoreConfig", func(data []interface{}) {
			fmt.Println("Store Configuration Successfully Loaded...")

			agent := cebadapter.GetAgent()

			agent.Client.OnEvent("globalConfigChanged.StoreConfig", func(from string, name string, data map[string]interface{}, resources map[string]interface{}) {
				cebadapter.GetLatestGlobalConfig("StoreConfig", func(data []interface{}) {
					fmt.Println("Store Configuration Successfully Updated...")
				})
			})
		})
		fmt.Println("Successfully registered in CEB")
	})

	gorest.RegisterService(new(RegistationService)) //Register our service
	http.Handle("/", gorest.Handle())
	argument := os.Args[1]
	fmt.Println(argument)
	http.ListenAndServe(":"+argument, nil)
}
Beispiel #15
0
func main() {
	flag.Parse()
	conf, err := config.LoadFromFile(*configFile)
	if err != nil {
		log.Fatalf("Error loading configuration from %s: %v", configFile, err)
	}

	persistence, err := leveldb.NewLevelDBMetricPersistence(*metricsStoragePath)
	if err != nil {
		log.Print(err)
		os.Exit(1)
	}

	go func() {
		notifier := make(chan os.Signal)
		signal.Notify(notifier, os.Interrupt)
		<-notifier
		persistence.Close()
		os.Exit(0)
	}()

	defer persistence.Close()

	scrapeResults := make(chan retrieval.Result, 4096)

	targetManager := retrieval.NewTargetManager(scrapeResults, 1)
	targetManager.AddTargetsFromConfig(conf)

	ruleResults := make(chan *rules.Result, 4096)

	ast.SetPersistence(persistence)
	ruleManager := rules.NewRuleManager(ruleResults, conf.Global.EvaluationInterval)
	err = ruleManager.AddRulesFromConfig(conf)
	if err != nil {
		log.Fatalf("Error loading rule files: %v", err)
	}

	go func() {
		gorest.RegisterService(new(api.MetricsService))
		exporter := registry.DefaultRegistry.YieldExporter()

		http.Handle("/", gorest.Handle())
		http.Handle("/metrics.json", exporter)
		http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
		http.ListenAndServe(":9090", nil)
	}()

	for {
		select {
		case scrapeResult := <-scrapeResults:
			//fmt.Printf("scrapeResult -> %s\n", scrapeResult)
			for _, sample := range scrapeResult.Samples {
				persistence.AppendSample(&sample)
			}
		case ruleResult := <-ruleResults:
			//fmt.Printf("ruleResult -> %s\n", ruleResult)
			for _, sample := range ruleResult.Samples {
				persistence.AppendSample(sample)
			}
		}
	}
}
Beispiel #16
0
func main() {
	gorest.RegisterService(new(TwilioService))
	http.Handle("/", gorest.Handle())
	http.ListenAndServe(":8787", nil)
}
func main() {
	gorest.RegisterService(&webservice.RegisterService{})
	http.Handle("/", gorest.Handle())
	http.ListenAndServe(":8787", nil)
}
Beispiel #18
0
func main() {
	gorest.RegisterService(new(HelloService)) //Register our service
	http.Handle("/", gorest.Handle())
	http.ListenAndServe(port, nil)
}
Beispiel #19
0
func main() {
	gorest.RegisterService(new(ConfigService))
	http.Handle("/", gorest.Handle())
	http.ListenAndServe(":"+os.Getenv("PORT"), nil)
}