Пример #1
0
func UrlsHandler(w http.ResponseWriter, req *http.Request) {
	urls := models.AllUrl()
	jsons, err := json.Marshal(urls)
	if err != nil {
		fmt.Println("error:", err)
	}
	w.Write(jsons)
}
Пример #2
0
func url_sender(urls chan models.Url) {
	ticker := time.NewTicker(time.Millisecond * 1000)
	for t := range ticker.C {
		fmt.Printf("t : %v\n", t)
		for _, url := range models.AllUrl() {
			urls <- url
		}
	}
}