package main import ( "database/sql" "fmt" "html" "log" "net/http" _ "github.com/mattn/go-sqlite3" ) // type Nota struct { // Medio string `json:"medio"` // Title string `json:"title"` // Link string `json:"link"` // PublicationDate string `json:"publication_date" db:"publication_date"` // CreatedAt string `json:"created_at" db:"created_at"` // } type fooHandler struct { DB *sql.DB } func (foo fooHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, ` Observatorio de medios `) } func main() { db, err := sql.Open("sqlite3", "./test.db?cache=shared") if err != nil { log.Panic(err) } defer db.Close() db.SetMaxOpenConns(1) http.Handle("/foo", fooHandler{db}) go cronologicalFetcher(db) log.Println("Listening in :8080") log.Fatal(http.ListenAndServe(":8080", nil)) }