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) }
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 } } }